[Jifty-commit] r1120 - in jifty/trunk: lib/Jifty lib/Jifty/Web
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri May 26 11:24:29 EDT 2006
Author: alexmv
Date: Fri May 26 11:24:28 2006
New Revision: 1120
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Action.pm
jifty/trunk/lib/Jifty/Web.pm
jifty/trunk/lib/Jifty/Web/Form.pm
Log:
r13312 at zoq-fot-pik: chmrr | 2006-05-26 11:24:09 -0400
* Docs for "call" in Jifty::Web::Form
* 'return' from an action
* Redirects should preserve continuations
Modified: jifty/trunk/lib/Jifty/Action.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action.pm (original)
+++ jifty/trunk/lib/Jifty/Action.pm Fri May 26 11:24:28 2006
@@ -437,6 +437,29 @@
Jifty->web->link(%args);
}
+=head3 return PARAMHASH
+
+Creates and renders a button, like L</button>, which additionally
+defaults to calling the current continuation.
+
+Takes an additional argument, C<to>, which can specify a default path
+to return to if there is no current continuation.
+
+=cut
+
+sub return {
+ my $self = shift;
+ my %args = (@_);
+ my $continuation = Jifty->web->request->continuation;
+ if (not $continuation and $args{to}) {
+ $continuation = Jifty::Continuation->new(request => Jifty::Request->new(path => $args{to}));
+ }
+ delete $args{to};
+
+ $self->button( call => $continuation, %args );
+}
+
+
=head1 NAMING METHODS
These methods return the names of HTML form elements related to this
Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm (original)
+++ jifty/trunk/lib/Jifty/Web.pm Fri May 26 11:24:28 2006
@@ -496,6 +496,7 @@
if ( $self->response->results
or $self->request->state_variables
or $self->{'state_variables'}
+ or $self->request->continuation
or @actions )
{
my $request = Jifty::Request->new();
@@ -514,6 +515,7 @@
arguments => $_->arguments,
);
}
+ $request->continuation($self->request->continuation);
my $cont = Jifty::Continuation->new(
request => $request,
response => $self->response,
@@ -675,7 +677,7 @@
@_
);
if ( defined wantarray ) {
- return $clickable->generate->render;
+ return $clickable->generate;
} else {
$clickable->state_variable( $_ => $self->{'state_variables'}{$_} )
for keys %{ $self->{'state_variables'} };
Modified: jifty/trunk/lib/Jifty/Web/Form.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form.pm Fri May 26 11:24:28 2006
@@ -13,7 +13,15 @@
=over
-=item name
+=item name
+
+The name given to the form. This is mostly for naming specific forms
+for testing.
+
+=item call
+
+All buttons in this form will act as continuation calls for the given
+continuation id.
=back
@@ -43,6 +51,10 @@
The form name
+=item call
+
+The continuation id to call
+
=back
=cut
@@ -75,6 +87,12 @@
=cut
+=head2 call [CONTID]
+
+Gets or sets the continuation ID that will be called for this form.
+
+=cut
+
=head2 is_open [BOOL]
This accessor returns true if Jifty is currently in the middle of rendering a form
@@ -84,9 +102,6 @@
=cut
-
-
-
=head2 add_action PARAMHASH
Calls L<Jifty::Web/new_action> with the paramhash given, and adds it to
@@ -120,8 +135,8 @@
=head2 has_action MONIKER
-If this form has an action whose monkier is C<MONIKER>, returns it. Otherwise returns undef.
-
+If this form has an action whose monkier is C<MONIKER>, returns
+it. Otherwise returns undef.
=cut
More information about the Jifty-commit
mailing list