[Jifty-commit] r860 - in jifty/trunk: lib/Jifty/Web/Form

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Apr 13 19:49:56 EDT 2006


Author: alexmv
Date: Thu Apr 13 19:49:56 2006
New Revision: 860

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web/Form/Clickable.pm
   jifty/trunk/lib/Jifty/Web/Form/Element.pm

Log:
 r12345 at zoq-fot-pik:  chmrr | 2006-04-13 19:49:35 -0400
  * Option to force Clickables to generate buttons
  * POD nits


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	Thu Apr 13 19:49:56 2006
@@ -25,10 +25,10 @@
 
 sub accessors {
     shift->SUPER::accessors,
-        qw(url escape_label tooltip continuation call returns submit preserve_state);
+        qw(url escape_label tooltip continuation call returns submit preserve_state button);
 }
 __PACKAGE__->mk_accessors(
-    qw(url escape_label tooltip continuation call returns submit preserve_state)
+    qw(url escape_label tooltip continuation call returns submit preserve_state button)
 );
 
 =head2 new PARAMHASH
@@ -97,6 +97,16 @@
 These will end up being submitted exactly like normal query
 parameters.
 
+=item button
+
+By default, Jifty will attempt to make the clickable into a link
+rather than a button, if there are no actions to run on submit.
+Providing a true value for C<button> forces L<generate> to produce a
+L<Jifty::Web::Form::Clickable::InlineButton> instead of a
+L<Jifty::Web::Form::Link>.  Note that providing a false value will
+B<not> guarantee that you get a link, as a button may be necessary
+based on the presence of the L</submit> parameter.
+
 =item Anything from L<Jifty::Web::Form::Element>
 
 =back
@@ -118,7 +128,8 @@
         continuation   => Jifty->web->request->continuation,
         submit         => [],
         preserve_state => 0,
-	parameters     => {},
+        parameters     => {},
+        button         => 0,
         @_,
     );
 
@@ -463,7 +474,7 @@
         }
     }
 
-    return ( ( not( $self->submit ) || @{ $self->submit } )
+    return ( ( not( $self->submit ) || @{ $self->submit } || $self->button )
         ? $self->as_button(@_)
         : $self->as_link(@_) );
 }

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	Thu Apr 13 19:49:56 2006
@@ -26,13 +26,13 @@
 =item append => PATH
 
 Add the given C<PATH> as a new fragment, just before the close of the
-CSS selector given by C<element>, which defaults to the end of the
+CSS selector given by L</element>, which defaults to the end of the
 current region.
 
 =item prepend => PATH
 
 Add the given C<PATH> as a new fragment, just after the start of the
-CSS selector given by C<element>, which defaults to the start of the
+CSS selector given by L</element>, which defaults to the start of the
 current region.
 
 =item replace_with => PATH
@@ -65,7 +65,7 @@
 =item element => CSS SELECTOR
 
 A css selector specifying where the new region should be placed; used
-with C<append> and C<prepend>, above.  The
+with L</append> and L</prepend>, above.  The
 L<Jifty::Web::PageRegion/get_element> method may be useful in
 specifying elements of parent page regions.
 


More information about the Jifty-commit mailing list