]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixed a problem with the ajax for deleting message board posts.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 28 Apr 2011 02:16:32 +0000 (02:16 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 28 Apr 2011 02:16:32 +0000 (02:16 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@9041 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/messageboard/views/default/messageboard/js.php

index 131c96c8a1d22bcb99e6dad0e43929c93a536fb3..5d89fcd690d23b2aa884a3d9cc8959d7db7eb6ee 100644 (file)
@@ -1,16 +1,18 @@
-
+//<script>
 elgg.provide('elgg.messageboard');
 
 elgg.messageboard.init = function() {
        var form = $('form[name=elgg-messageboard]');
        form.find('input[type=submit]').live('click', elgg.messageboard.submit);
 
-       // can't undelete because of init load order
-       form.parent().find('a.elgg-requires-confirmation').removeClass('elgg-requires-confirmation');
-       // delegate() instead of live() because live() has to be at the top level of chains...can't use parent().
+       // remove the default binding for confirmation since we're doing extra stuff.
+       // @todo remove if we add a hook to the requires confirmation callback
+       form.parent().find('a.elgg-requires-confirmation')
+               .click(elgg.messageboard.deletePost)
 
-       // delete is a little-known operator in JS. IE loses its mind if you name a method that.
-       form.parent().delegate('.elgg-button-delete a', 'click', elgg.messageboard.deletePost);
+               // double whammy for in case the load order changes.
+               .unbind('click', elgg.ui.requiresConfirmation)
+               .removeClass('elgg-requires-confirmation');
 }
 
 elgg.messageboard.submit = function(e) {