aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ComponentUI
diff options
context:
space:
mode:
authorwreis <wreis@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-08-05 01:58:14 +0000
committerwreis <wreis@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-08-05 01:58:14 +0000
commitb210789fed64cda65459e48b7f68b88733c04dd7 (patch)
treec8ca8ef75b411cd4e9b02a38f670db09eeb24760 /lib/ComponentUI
parent2f4c7285eeda79854ef6fc2ebbd878e89d1d19e3 (diff)
parent4b70129e4e977a51616faaaeefd61a39367861f0 (diff)
downloadreaction-b210789fed64cda65459e48b7f68b88733c04dd7.tar.gz
reaction-b210789fed64cda65459e48b7f68b88733c04dd7.zip
r4466@www43 (orig r1196): groditi | 2009-08-01 15:07:10 -0500
make "class" in the config for push_vieport work correctly r4488@www43 (orig r1199): groditi | 2009-08-03 17:25:09 -0500 let delete have its own callback by default r4499@www43 (orig r1207): groditi | 2009-08-04 11:01:28 -0500 r30359@martha (orig r1198): groditi | 2009-08-01 16:57:29 -0400 example of how to create forms that return users to the URI they came from
Diffstat (limited to 'lib/ComponentUI')
-rw-r--r--lib/ComponentUI/Controller/TestModel/Bar.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/ComponentUI/Controller/TestModel/Bar.pm b/lib/ComponentUI/Controller/TestModel/Bar.pm
index c649d78..4701fff 100644
--- a/lib/ComponentUI/Controller/TestModel/Bar.pm
+++ b/lib/ComponentUI/Controller/TestModel/Bar.pm
@@ -8,6 +8,7 @@ __PACKAGE__->config(
collection_name => 'Bar',
action => {
base => { Chained => '/base', PathPart => 'testmodel/bar' },
+ create => { ViewPort => { layout => 'bar/create' } },
list => {
ViewPort => {
enable_order_by => [qw/name foo published_at/],
@@ -32,7 +33,27 @@ sub create :Chained('base') {
my $action_vp = $self->next::method(@_);
my $self_uri = $c->uri_for($self->action_for('create'));
$action_vp->action($self_uri);
+
+ my $params = $c->request->parameters;
+ if ( defined $params->{return_to_uri} && $params->{return_to_uri} ){
+ if( $params->{return_to_uri} ne $c->request->uri ){
+ $action_vp->layout_args->{return_to_uri} = $params->{return_to_uri};
+ }
+ } elsif( $c->request->referer ne $c->request->uri) {
+ $action_vp->layout_args->{return_to_uri} = $c->request->referer;
+ }
+
return $action_vp;
}
+sub on_create_close_callback {
+ my($self, $c, $vp) = @_;
+ if ( my $return_to_uri = delete $c->request->parameters->{return_to_uri} ){
+ $c->response->redirect( $return_to_uri );
+ } else {
+ $self->redirect_to( $c, 'list' );
+ }
+ $c->detach;
+}
+
1;