let delete have its own callback by default
[catagits/Reaction.git] / lib / Reaction / UI / Controller / Collection / CRUD.pm
index 6dfed13..11a29f9 100644 (file)
@@ -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;