Skip to content

Instantly share code, notes, and snippets.

@chandresh
Created January 9, 2012 01:39
Show Gist options
  • Save chandresh/1580495 to your computer and use it in GitHub Desktop.
Save chandresh/1580495 to your computer and use it in GitHub Desktop.
$(window).bind('mercury:ready', function() {
var link = $('#mercury_iframe').contents().find('#edit_link');
Mercury.saveURL = link.data('save-url');
link.hide();
});
$(window).bind('mercury:saved', function() {
window.location = window.location.href.replace(/\/editor\//i, '/');
});
@chandresh
Copy link
Author

It seems to be working.. need to tweak it to make the railscasts version... will post that shortly.

@chandresh
Copy link
Author

This works!!

onload: function() {
//Mercury.PageEditor.prototype.iframeSrc = function(url) { return '/testing'; }
Mercury.on('ready', function() {
var link = $('#mercury_iframe').contents().find('#edit_link');
Mercury.saveURL = link.data('save-url');
link.hide();
});

Mercury.on('saved', function() {
  window.location.href = window.location.href.replace(/\/editor\//i, '/');
});

}

@cthree
Copy link

cthree commented Jan 9, 2012

Any chance you could post the whole, working mercury.js file? I'm still not getting a good result.

@chandresh
Copy link
Author

@cthree
Copy link

cthree commented Jan 9, 2012 via email

@chandresh
Copy link
Author

:)

@chandresh
Copy link
Author

For those who read this; please add to your Gemfile, as commented by cthree on main discussion of the issue:

gem 'mercury-rails', git: 'https://github.com/jejacks0n/mercury.git'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment