We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit f3e0cd0b authored by Zach Copley's avatar Zach Copley

Some special .js for the bookmark plugin, so we can control the form in the second step

parent eaca17be
...@@ -130,6 +130,11 @@ class BookmarkPlugin extends MicroAppPlugin ...@@ -130,6 +130,11 @@ class BookmarkPlugin extends MicroAppPlugin
return true; return true;
} }
function onEndShowScripts($action)
{
$action->script($this->path('js/bookmark.js'));
return true;
}
/** /**
* Load related modules when needed * Load related modules when needed
* *
......
var Bookmark = {
// Special XHR that sends in some code to be run
// when the full bookmark form gets loaded
BookmarkXHR: function(form)
{
SN.U.FormXHR(form, Bookmark.InitBookmarkForm);
return false;
},
// Special initialization function just for the
// second step in the bookmarking workflow
InitBookmarkForm: function() {
alert('Gar!');
// Put fancy stuff here
}
}
$(document).ready(function() {
// Stop normal live event stuff
$('form.ajax').die();
$('form.ajax input[type=submit]').die();
// Make the bookmark submit super special
$('#form_initial_bookmark').bind('submit', function(e) {
Bookmark.BookmarkXHR($(this));
e.stopPropagation();
return false;
});
// Restore live event stuff to other forms & submit buttions
SN.Init.AjaxForms();
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment