From 35dd77ad06c0e5b96684751183253e736e189f04 Mon Sep 17 00:00:00 2001 From: groditi Date: Mon, 3 Aug 2009 22:25:09 +0000 Subject: let delete have its own callback by default --- lib/Reaction/UI/Controller/Collection/CRUD.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Reaction/UI/Controller/Collection/CRUD.pm b/lib/Reaction/UI/Controller/Collection/CRUD.pm index 6dfed13..11a29f9 100644 --- a/lib/Reaction/UI/Controller/Collection/CRUD.pm +++ b/lib/Reaction/UI/Controller/Collection/CRUD.pm @@ -90,13 +90,21 @@ sub on_update_close_callback { sub delete :Chained('object') :Args(0) { my ($self, $c) = @_; - my $close = sub { $self->on_update_close_callback( @_) }; + my $close = sub { $self->on_delete_close_callback( @_) }; my $vp_args = { on_close_callback => $self->make_context_closure($close), }; $self->basic_model_action( $c, $vp_args); } +sub on_delete_close_callback { + my($self, $c) = @_; + #this needs a better solution. currently thinking about it + my @cap = @{$c->req->captures}; + pop(@cap); # object id + $self->redirect_to($c, 'list', \@cap); +} + sub basic_model_action { my ($self, $c, $vp_args) = @_; my $stash = $c->stash; -- cgit v1.2.3-54-g00ecf