[javascript] make inlinedform-added event bindable stable
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Mon, 21 Sep 2009 15:55:40 +0200
branchstable
changeset 3342 8b30ae9c4e67
parent 3341 99c0b55892d6
child 3343 383b42263bb1
[javascript] make inlinedform-added event bindable $(form).trigger('inlinedform-added') was not usable since form had no existence outside the inner callback. Use the general CubicWeb object to trigger the event so it's easy to bind a callback wherever it's needed.
web/data/cubicweb.edition.js
--- a/web/data/cubicweb.edition.js	Mon Sep 21 15:33:46 2009 +0200
+++ b/web/data/cubicweb.edition.js	Mon Sep 21 15:55:40 2009 +0200
@@ -254,7 +254,7 @@
         form.insertBefore(insertBefore).slideDown('fast');
         updateInlinedEntitiesCounters(rtype);
         reorderTabindex();
-        form.trigger('inlinedform-added');
+        jQuery(CubicWeb).trigger('inlinedform-added', form);
         // if the inlined form contains a file input, we must force
         // the form enctype to multipart/form-data
         if (form.find('input:file').length) {