[Jifty-commit] r5060 - in jifty/trunk: . lib/Jifty/Web/Form t/TestApp/lib/TestApp t/TestApp/share/web/templates/_elements

Jifty commits jifty-commit at lists.jifty.org
Wed Feb 6 16:14:22 EST 2008


Author: alexmv
Date: Wed Feb  6 16:14:17 2008
New Revision: 5060

Added:
   jifty/trunk/t/TestApp/t/21-js-arguments.t
Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web/Form/Clickable.pm
   jifty/trunk/t/TestApp/lib/TestApp/View.pm
   jifty/trunk/t/TestApp/share/web/templates/_elements/wrapper

Log:
 r27521 at zoq-fot-pik:  chmrr | 2008-02-06 16:02:33 -0500
  * onclick => { submit => { action => $a, arguments => { a => "b" }}}
    now propagates the action arguments to the non-JS click as well.


Modified: jifty/trunk/lib/Jifty/Web/Form/Clickable.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Clickable.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Clickable.pm	Wed Feb  6 16:14:17 2008
@@ -103,7 +103,7 @@
               ]
 
 If you specify arguments in the submit block for a button, they will override 
-any values from form fileds submitted by the user.
+any values from form fields submitted by the user.
 
 
 =item preserve_state
@@ -621,8 +621,14 @@
                 for keys %{ $hook->{args} };
             if ( $hook->{submit} ) {
                 $self->{submit} ||= [];
-                $hook->{submit} = [ $hook->{submit} ]
-                    unless ref $hook->{submit} eq "ARRAY";
+                for my $moniker ( @{ $hook->{submit} } ) {
+                    my $action = Jifty->web->{'actions'}{$moniker};
+                    $self->register_action($action);
+                    $self->parameter( $action->form_field_name($_),
+                        $hook->{action_arguments}{$moniker}{$_} )
+                        for
+                        keys %{ $hook->{action_arguments}{$moniker} || {} };
+                }
                 push @{ $self->{submit} }, @{ $hook->{submit} };
             }
         }

Modified: jifty/trunk/t/TestApp/lib/TestApp/View.pm
==============================================================================
--- jifty/trunk/t/TestApp/lib/TestApp/View.pm	(original)
+++ jifty/trunk/t/TestApp/lib/TestApp/View.pm	Wed Feb  6 16:14:17 2008
@@ -7,7 +7,7 @@
 __PACKAGE__->use_mason_wrapper;
 
 template 'say_hi' => page {
-    my $a = Jifty->web->new_action( class => 'SayHi' );
+    my $a = Jifty->web->new_action( class => 'SayHi', moniker => "say_hi" );
     form {
 
         #render_param($a => 'name');

Modified: jifty/trunk/t/TestApp/share/web/templates/_elements/wrapper
==============================================================================
--- jifty/trunk/t/TestApp/share/web/templates/_elements/wrapper	(original)
+++ jifty/trunk/t/TestApp/share/web/templates/_elements/wrapper	Wed Feb  6 16:14:17 2008
@@ -17,6 +17,7 @@
 <div id="custom-stuff">Custom Wrapper</div>
   </div>
   <div id="jifty-wait-message" style="display: none"><%_('Loading...')%></div>
+  <div id="jifty-result-popup"></div>
 % Jifty::Mason::Halo->render_component_tree() if (Jifty->config->framework('DevelMode') );
 %# This is required for jifty server push.  If you maintain your own
 %# wrapper, make sure you have this as well.

Added: jifty/trunk/t/TestApp/t/21-js-arguments.t
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp/t/21-js-arguments.t	Wed Feb  6 16:14:17 2008
@@ -0,0 +1,32 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+=head1 DESCRIPTION
+
+If we do a redirect in a 'before' in the dispatcher, actions should
+still get run.
+
+=cut
+
+use lib 't/lib';
+use Jifty::SubTest;
+use Jifty::Test tests => 6;
+use Jifty::Test::WWW::Mechanize;
+
+my $server  = Jifty::Test->make_server;
+
+isa_ok($server, 'Jifty::Server');
+
+my $URL     = $server->started_ok;
+my $mech    = Jifty::Test::WWW::Mechanize->new();
+
+$mech->get_ok("$URL/say_hi", "Got right page");
+
+$mech->fill_in_action_ok('say_hi', greeting => "something");
+ok($mech->click_button(value => "Create"));
+$mech->content_contains("dave, something", "Contains right result");
+
+1;
+


More information about the Jifty-commit mailing list