File: redirect-after-change.patch

package info (click to toggle)
libcatalyst-model-cdbi-crud-perl 0.04-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 108 kB
  • ctags: 18
  • sloc: perl: 36; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 788 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Description: redirect the user to the list after addition or deletion
 This way there is no weirdness with browser's back/forward actions
Author: Joachim Breitner <nomeata@debian.org>
Bug: http://rt.cpan.org/Public/Bug/Display.html?id=49429
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=330387

--- a/CRUD.pm
+++ b/CRUD.pm
@@ -75,7 +75,7 @@ Deletes a L<Class::DBI> object.
 sub destroy {
     my ( $self, $c ) = @_;
     $c->stash->{item}->delete;
-    $c->stash->{template} = 'list';
+    $c->res->redirect('../list');
 }
 
 =head3 do_add
@@ -87,7 +87,7 @@ Creates a new L<Class::DBI> object from
 sub do_add {
     my ( $self, $c ) = @_;
     $self->create_from_form( $c->form );
-    $c->stash->{template} = 'list';
+    $c->res->redirect('list');
 }
 
 =head3 do_edit