[Jifty-commit] r5777 - in jifty/trunk: lib/Jifty/Web/Form share/web/static/js

Jifty commits jifty-commit at lists.jifty.org
Tue Sep 2 10:25:45 EDT 2008


Author: gugod
Date: Tue Sep  2 10:25:37 2008
New Revision: 5777

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web/Form/Element.pm
   jifty/trunk/share/web/static/js/jifty.js

Log:
 r9328 at yra:  gugod | 2008-09-02 21:28:06 +0800
 Write a Jifty.stopEvent to do what Event.stop (from prototype) was
 being doing.
 


Modified: jifty/trunk/lib/Jifty/Web/Form/Element.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Element.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Element.pm	Tue Sep  2 10:25:37 2008
@@ -513,7 +513,8 @@
                 : "$update; return true;";
         }
         if ($confirm) {
-            $string = "if(!confirm(" . Jifty::JSON::objToJson($confirm, {singlequote => 1}) . ")) { Event.stop(event); return false }" . $string;
+            my $text = Jifty::JSON::objToJson($confirm, {singlequote => 1});
+            $string = "if(!confirm($text)){ Jifty.stopEvent(event); return false; }" . $string;
         }
         if ($beforeclick) {
            $string = $beforeclick . $string;

Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js	(original)
+++ jifty/trunk/share/web/static/js/jifty.js	Tue Sep  2 10:25:37 2008
@@ -24,6 +24,12 @@
     return r ? true : false;
 }();
 
+Jifty.stopEvent = function(ev) {
+    jQuery.event.fix(ev);
+    ev.preventDefault();
+    ev.stopPropagation();
+};
+
 Jifty.Web = {};
 Jifty.Web.current_actions = [];
 Jifty.Web.new_action = function() {


More information about the Jifty-commit mailing list