8 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
9 |
|
|
10 |
template '/pictures' => page { |
template '/pictures' => page { |
|
h1 { _("Pictures available in system") }; |
|
11 |
my $fc = Arh::Model::PictureCollection->new; |
my $fc = Arh::Model::PictureCollection->new; |
12 |
$fc->unlimit; |
$fc->unlimit; |
13 |
my $present; |
my $present; |
14 |
form { |
form { |
15 |
|
if ( $fc->count ) { |
16 |
|
h1 { _("Pictures available in system") }; |
17 |
|
} |
18 |
table { |
table { |
19 |
while ( my $f = $fc->next ) { |
while ( my $f = $fc->next ) { |
20 |
$present->{ $f->filename }++; |
$present->{ $f->filename }++; |
22 |
my $update = new_action( class => 'UpdatePicture', record => $f ); |
my $update = new_action( class => 'UpdatePicture', record => $f ); |
23 |
row { |
row { |
24 |
cell { |
cell { |
25 |
|
attr { class => 'picture' }; |
26 |
img { attr { src => "static/pics/" . $f->filename } } |
img { attr { src => "static/pics/" . $f->filename } } |
27 |
div { tt{ $f->filename } } |
div { tt{ $f->filename } } |
28 |
} |
} |
29 |
cell { |
cell { |
30 |
|
attr { class => 'picture-description' }; |
31 |
render_param( $update => 'campaign', render_mode => 'read' ); |
render_param( $update => 'campaign', render_mode => 'read' ); |
32 |
render_param( $update => 'type', render_mode => 'read' ); |
render_param( $update => 'type', render_mode => 'read' ); |
33 |
div { |
if ( $f->current_user_can('write') ) { |
34 |
$delete->button( |
div { |
35 |
submit => $delete, |
$delete->button( |
36 |
label => _('Delete'), |
submit => $delete, |
37 |
arguments => { |
label => _('Delete'), |
38 |
id => $f->id, |
arguments => { |
39 |
} |
id => $f->id, |
40 |
) |
} |
41 |
|
) |
42 |
|
} |
43 |
} |
} |
44 |
} |
} |
45 |
} |
} |
46 |
} |
} |
47 |
row { |
row { |
48 |
cell { attr { colspan => 4 } outs _('Pending pictures') } |
cell { attr { colspan => 2 } h1 { _('Pending pictures') } } |
49 |
}; |
}; |
50 |
warn "## present = ",dump( $present ); |
warn "## present = ",dump( $present ); |
51 |
foreach my $f ( Arh::Model::Picture->all_filenames ) { |
foreach my $f ( Arh::Model::Picture->all_filenames ) { |
53 |
my $create = new_action( class => 'CreatePicture' ); |
my $create = new_action( class => 'CreatePicture' ); |
54 |
row { |
row { |
55 |
cell { |
cell { |
56 |
|
attr { class => 'picture' }; |
57 |
img { attr { src => "static/pics/$f" } } |
img { attr { src => "static/pics/$f" } } |
58 |
div { tt{ $f } } |
div { tt{ $f } } |
59 |
} |
} |
60 |
cell { |
cell { |
61 |
|
attr { class => 'picture-description' }; |
62 |
render_param( $create => 'campaign' ); |
render_param( $create => 'campaign' ); |
63 |
render_param( $create => 'type' ); |
render_param( $create => 'type' ); |
64 |
$create->button( |
$create->button( |