Sha256: b82a6a19abe634d32ac880b1e32e02e8bb62c50132aaff0abf8825a14c56882f

Contents?: true

Size: 981 Bytes

Versions: 7

Compression:

Stored size: 981 Bytes

Contents

document.observe('dom:loaded', function() {
  
  var previewer = $('preview_panel')
  var preview_tools = previewer.down('.preview_tools')
  var frame = $('page-preview')
  var body = document.body
  
  Event.addBehavior({
   "div.preview_tools a.cancel:click" : function(event) {
      previewer.hide()
      body.removeClassName('clipped')
      frame.src = ''
      event.stop()
    },
    "iframe:load" : function(event) {
      preview_tools.style['opacity'] = null
    }
  });
  
  
  $('show-preview').observe('click', function(e) {
    e.stop();
    
    var form = this.form,
      oldTarget = form.target,
      oldAction = form.action
    
    try {
      $(body).scrollTo()
      previewer.show()
      preview_tools.style['opacity'] = 1
      body.addClassName('clipped')
      form.target = frame.id
      form.action = relative_url_root + '/admin/preview'
      form.submit()
    } finally {
      form.target = oldTarget
      form.action = oldAction
    }
  })
})

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
trusty-cms-1.0.0 public/javascripts/admin/page_preview.js
radiant-1.1.4 public/javascripts/admin/page_preview.js
radiant-1.1.3 public/javascripts/admin/page_preview.js
radiant-1.1.2 public/javascripts/admin/page_preview.js
radiant-1.1.1 public/javascripts/admin/page_preview.js
radiant-1.1.0 public/javascripts/admin/page_preview.js
radiant-1.1.0.rc1 public/javascripts/admin/page_preview.js