[Jifty-commit] r5142 - in jifty/branches/jquery: share/plugins/Jifty/Plugin/Prototypism/web/static/js/prototypism

Jifty commits jifty-commit at lists.jifty.org
Wed Feb 20 06:55:57 EST 2008


Author: gugod
Date: Wed Feb 20 06:55:36 2008
New Revision: 5142

Added:
   jifty/branches/jquery/share/plugins/Jifty/Plugin/Prototypism/web/static/js/prototypism/jifty_compatible.js   (contents, props changed)
Modified:
   jifty/branches/jquery/lib/Jifty/Plugin/Prototypism.pm

Log:
Check if Prototypism is auto-included, if so, make the old Form.*
based API a wrapper to Jifty.Form.* API.


Modified: jifty/branches/jquery/lib/Jifty/Plugin/Prototypism.pm
==============================================================================
--- jifty/branches/jquery/lib/Jifty/Plugin/Prototypism.pm	(original)
+++ jifty/branches/jquery/lib/Jifty/Plugin/Prototypism.pm	Wed Feb 20 06:55:36 2008
@@ -33,6 +33,7 @@
         scriptaculous/controls
     );
 
+    push @js, 'jifty_compatible' if Jifty->config->framework('ConfigFileVersion') < 4;
     Jifty->web->add_javascript( "prototypism/$_.js" ) for @js;
 
 }

Added: jifty/branches/jquery/share/plugins/Jifty/Plugin/Prototypism/web/static/js/prototypism/jifty_compatible.js
==============================================================================
--- (empty file)
+++ jifty/branches/jquery/share/plugins/Jifty/Plugin/Prototypism/web/static/js/prototypism/jifty_compatible.js	Wed Feb 20 06:55:36 2008
@@ -0,0 +1,33 @@
+// Compatible notice for old school
+
+(function($) {
+    $.each(
+        Jifty.Form,
+        function(k, v) {
+            if ( $.isFunction(v) && Form[k] == null ) {
+                Form[k] = function() {
+                    alert("Form." + k +
+                          " is going to be depcreated. Please use Jifty.Form." + k +
+                          " instead.");
+                    v.apply(Jifty.Form, arguments);
+                }
+            }
+        }
+    );
+
+    $.each(
+        Jifty.Form.Element,
+        function(k, v) {
+            if ( $.isFunction(v) && Form.Element[k] == null ) {
+                Form.Element[k] = function() {
+                    alert("Form.Element" + k +
+                          " is going to be depcreated. Please use Jifty.Form.Element" + k +
+                          " instead.");
+                    v.apply(Jifty.Form.Element, arguments);
+                }
+            }
+        }
+    );
+
+})(jQuery);
+


More information about the Jifty-commit mailing list