[Jifty-commit] r3026 - in jifty/trunk: lib/Jifty lib/Jifty/View/Declare lib/Jifty/Web

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun Mar 18 22:03:25 EDT 2007


Author: jesse
Date: Sun Mar 18 22:03:24 2007
New Revision: 3026

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/View/Declare/Helpers.pm
   jifty/trunk/lib/Jifty/Web.pm
   jifty/trunk/lib/Jifty/Web/Form.pm

Log:
 r53621 at pinglin:  jesse | 2007-03-18 21:35:20 -0400
 * Added the ability to have a return button that looks like a submit button on a form.


Modified: jifty/trunk/lib/Jifty/View/Declare/Helpers.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Declare/Helpers.pm	(original)
+++ jifty/trunk/lib/Jifty/View/Declare/Helpers.pm	Sun Mar 18 22:03:24 2007
@@ -145,12 +145,12 @@
 
 =head2 form_return
 
-Shortcut for L<Jifty::Web/return>.
+Shortcut for L<Jifty::Web::Form/return>.
 
 =cut
 
 sub form_return(@) {
-    outs_raw( Jifty->web->return(@_) );
+    outs_raw( Jifty->web->form->return(@_) );
     '';
 }
 

Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm	(original)
+++ jifty/trunk/lib/Jifty/Web.pm	Sun Mar 18 22:03:24 2007
@@ -776,7 +776,8 @@
 
 sub return {
     my $self = shift;
-    my %args = (@_);
+    my %args = (to => undef,
+                @_);
     my $continuation = Jifty->web->request->continuation;
     if (not $continuation and $args{to}) {
         $continuation = Jifty::Continuation->new(

Modified: jifty/trunk/lib/Jifty/Web/Form.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form.pm	Sun Mar 18 22:03:24 2007
@@ -226,6 +226,26 @@
     return '';
 }
 
+=head2 return MESSAGE, [PARAMETERS]
+
+Renders a return button with the text MESSAGE on it (which will be
+HTML escaped).  Returns the empty string (for ease of use in
+interpolation).  Any extra PARAMETERS are passed to
+L<Jifty::Web::Form::Field::Button>'s constructor.
+
+=cut
+
+sub return {
+    my $self = shift;
+
+    my $button = Jifty->web->return(as_button => 1, @_);
+    Jifty->web->out(qq{<div class="submit_button">});
+    $button->render_widget;
+    Jifty->web->out(qq{</div>});
+
+    return '';
+}
+
 =head2 end
 
 Renders the closing form tag (including rendering errors for and


More information about the Jifty-commit mailing list