[Jifty-commit] r5159 - in jifty/trunk: lib/Jifty lib/Jifty/Plugin share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/fragments/list

Jifty commits jifty-commit at lists.jifty.org
Fri Feb 22 02:21:41 EST 2008


Author: sartak
Date: Fri Feb 22 02:21:40 2008
New Revision: 5159

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/CSSQuery.pm
   jifty/trunk/lib/Jifty/Web.pm
   jifty/trunk/share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/fragments/list/new_item

Log:
 r52007 at onn:  sartak | 2008-02-22 02:21:27 -0500
 Use the cssQuery-jquery back-compat script, and have the CSSQuery plugin remove it
 This way the jifty.js cssQuery call actually works
 Which fixes the admin CRUD
 Woo hoo


Modified: jifty/trunk/lib/Jifty/Plugin/CSSQuery.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/CSSQuery.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/CSSQuery.pm	Fri Feb 22 02:21:40 2008
@@ -37,11 +37,16 @@
 =head2 init
 
 This initializes the plugin, which simply includes the JavaScript
-necessary to load cssQuery.
+necessary to load cssQuery, and gets rid of the cssQuery-jquery back-compat
+script.
 
 =cut
 
 sub init {
+    Jifty->web->remove_javascript(
+        'cssQuery-jquery.js',
+    );
+
     Jifty->web->add_javascript(
         'cssquery/cssQuery.js',
         'cssquery/cssQuery-level2.js',

Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm	(original)
+++ jifty/trunk/lib/Jifty/Web.pm	Fri Feb 22 02:21:40 2008
@@ -70,6 +70,7 @@
     app.js
     app_behaviour.js
     css_browser_selector.js
+    cssQuery-jquery.js
 )]);
 
 use Class::Trigger;
@@ -1171,6 +1172,25 @@
     Jifty->web->javascript_libs([ @{ Jifty->web->javascript_libs }, @_ ]);
 }
 
+=head3 remove_javascript FILE1, FILE2, ...
+
+Removes the given files from C<< Jifty->web->javascript_libs >>.
+
+This is intended for plugins or applications that provide another version of
+the functionality given in our default JS libraries. For example, the CSSQuery
+plugin will get rid of the cssQuery-jQuery.js back-compat script.
+
+=cut
+
+sub remove_javascript {
+    my $self = shift;
+    my %remove = map { $_ => 1 } @_;
+
+    Jifty->web->javascript_libs([
+        grep { !$remove{$_} } @{ Jifty->web->javascript_libs }
+    ]);
+}
+
 =head3 add_external_javascript URL1, URL2, ...
 
 Pushes urls onto C<Jifty->web->external_javascript_libs>

Modified: jifty/trunk/share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/fragments/list/new_item
==============================================================================
--- jifty/trunk/share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/fragments/list/new_item	(original)
+++ jifty/trunk/share/plugins/Jifty/Plugin/AdminUI/web/templates/__jifty/admin/fragments/list/new_item	Fri Feb 22 02:21:40 2008
@@ -6,10 +6,13 @@
 $list_path
 </%args>
 <%init>
-my $record_class = Jifty->app_class("Model", $object_type);
-my $create = Jifty->web->new_action(class => 'Create'.$object_type);
+my $create = Jifty->web->new_action(
+    class => "Create$object_type",
+    moniker => "create-$object_type",
+);
 </%init>
 <% Jifty->web->form->start %>
+% Jifty->web->form->register_action($create);
 
 % if ($mask_field) {
   <% $create->hidden($mask_field,$mask_val) %>
@@ -33,7 +36,7 @@
                    append => $list_path.'view',
                    args   => { 
                               object_type => $object_type,
-                              list_path => $list_path,
+                              list_path   => $list_path,
                               id          => { result_of => $create, name => 'id' },
                              },
                  },


More information about the Jifty-commit mailing list