| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Wishlist::Controller::List; |
|
2
|
1
|
|
|
1
|
|
14629
|
use Mojo::Base 'Mojolicious::Controller'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
sub show_add { |
|
5
|
1
|
|
|
1
|
0
|
260
|
my $c = shift; |
|
6
|
|
|
|
|
|
|
$c->link($c->param('url'), sub { |
|
7
|
1
|
|
|
1
|
|
316
|
my $link = $_[1]; |
|
8
|
1
|
|
|
|
|
4
|
$c->render('add', link => $link); |
|
9
|
1
|
|
|
|
|
6
|
}); |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub do_add { |
|
13
|
0
|
|
|
0
|
0
|
|
my $c = shift; |
|
14
|
0
|
|
|
|
|
|
my %item = ( |
|
15
|
|
|
|
|
|
|
title => $c->param('title'), |
|
16
|
|
|
|
|
|
|
url => $c->param('url'), |
|
17
|
|
|
|
|
|
|
purchased => 0, |
|
18
|
|
|
|
|
|
|
); |
|
19
|
0
|
|
|
|
|
|
$c->model->add_item($c->user, \%item); |
|
20
|
0
|
|
|
|
|
|
$c->redirect_to('/'); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub update { |
|
24
|
0
|
|
|
0
|
0
|
|
my $c = shift; |
|
25
|
0
|
|
|
|
|
|
$c->model->update_item( |
|
26
|
|
|
|
|
|
|
{id => $c->param('id')}, |
|
27
|
|
|
|
|
|
|
$c->param('purchased') |
|
28
|
|
|
|
|
|
|
); |
|
29
|
0
|
0
|
|
|
|
|
if (my $url = $c->param('next_url')) { |
|
30
|
0
|
|
|
|
|
|
return $c->redirect_to($url); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
0
|
|
|
|
|
|
return $c->redirect_to('/'); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub remove { |
|
36
|
0
|
|
|
0
|
0
|
|
my $c = shift; |
|
37
|
0
|
|
|
|
|
|
$c->model->remove_item( |
|
38
|
|
|
|
|
|
|
{id => $c->param('id')}, |
|
39
|
|
|
|
|
|
|
); |
|
40
|
0
|
|
|
|
|
|
$c->redirect_to('/'); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
|
44
|
|
|
|
|
|
|
|