Created
January 9, 2012 01:39
-
-
Save chandresh/1580495 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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, '/'); | |
}); |
Thanks.. doing a quick test..
It seems to be working.. need to tweak it to make the railscasts version... will post that shortly.
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, '/');
});
}
Any chance you could post the whole, working mercury.js file? I'm still not getting a good result.
Sure... https://gist.github.com/1581146
Thanks! That answered all my questions :-)
…On 01/08/2012, at 11:38 PM, Chandresh Pant wrote:
Sure... https://gist.github.com/1581146
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1580495
:)
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
This is pulled directly from my mercury.js.. note that the saveURL is set to mercury/images, because in my scenario it's the only route that accepts posts. It should be noted that the onload function came after the railscast, and is inside your configuration (mercury.js).