aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/Controller/Collection
diff options
context:
space:
mode:
authoredenc <edenc@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-08-08 00:57:13 +0000
committeredenc <edenc@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-08-08 00:57:13 +0000
commit52f292b24eca44347e5f1bfcffe4cedf5465766b (patch)
treeda0437d1ee31f62f33aeb916845e2f15998192f8 /lib/Reaction/UI/Controller/Collection
parenta86de581e80ee37e60860bde8ddaa975ff7dd6c9 (diff)
downloadreaction-52f292b24eca44347e5f1bfcffe4cedf5465766b.tar.gz
reaction-52f292b24eca44347e5f1bfcffe4cedf5465766b.zip
removed viewport dependency on ->ctx
Diffstat (limited to 'lib/Reaction/UI/Controller/Collection')
-rw-r--r--lib/Reaction/UI/Controller/Collection/CRUD.pm38
1 files changed, 28 insertions, 10 deletions
diff --git a/lib/Reaction/UI/Controller/Collection/CRUD.pm b/lib/Reaction/UI/Controller/Collection/CRUD.pm
index ab0fc9b..285947b 100644
--- a/lib/Reaction/UI/Controller/Collection/CRUD.pm
+++ b/lib/Reaction/UI/Controller/Collection/CRUD.pm
@@ -55,15 +55,22 @@ sub get_model_action {
sub create :Chained('base') :PathPart('create') :Args(0) {
my ($self, $c) = @_;
my $vp_args = {
- next_action => 'list',
- on_apply_callback => sub { $self->after_create_callback($c => @_); },
- };
+ on_apply_callback => sub { $self->after_create_callback($c => @_); },
+ on_close_callback => sub { $self->on_create_close_callback($c => @_) }
+ };
$self->basic_model_action( $c, $vp_args);
}
sub delete_all :Chained('base') :PathPart('delete_all') :Args(0) {
my ($self, $c) = @_;
- $self->basic_model_action( $c, { next_action => 'list'});
+ $self->basic_model_action( $c, {
+ on_close_callback => sub { $self->on_delete_all_close_callback($c => @_) }
+ });
+}
+
+sub on_delete_all_close_callback {
+ my($self, $c) = @_;
+ $self->redirect_to($c, 'list');
}
sub after_create_callback {
@@ -72,21 +79,32 @@ sub after_create_callback {
( $c, 'update', [ @{$c->req->captures}, $result->id ] );
}
+sub on_create_close_callback {
+ my($self, $c, $vp) = @_;
+ $self->redirect_to( $c, 'list' );
+}
+
sub update :Chained('object') :Args(0) {
my ($self, $c) = @_;
+ my $vp_args = {
+ on_close_callback => sub { $self->on_update_close_callback($c => @_ ) }
+ };
+ $self->basic_model_action( $c, $vp_args);
+}
+
+sub on_update_close_callback {
+ my($self, $c) = @_;
#this needs a better solution. currently thinking about it
my @cap = @{$c->req->captures};
pop(@cap); # object id
- my $vp_args = { next_action => [ $self, 'redirect_to', 'list', \@cap ]};
- $self->basic_model_action( $c, $vp_args);
+ $self->redirect_to($c, 'list', \@cap);
}
sub delete :Chained('object') :Args(0) {
my ($self, $c) = @_;
- #this needs a better solution. currently thinking about it
- my @cap = @{$c->req->captures};
- pop(@cap); # object id
- my $vp_args = { next_action => [ $self, 'redirect_to', 'list', \@cap ]};
+ my $vp_args = {
+ on_close_callback => sub { $self->on_update_close_callback($c => @_) }
+ };
$self->basic_model_action( $c, $vp_args);
}