--- lib/Arh/View.pm 2007/11/29 19:04:56 11 +++ lib/Arh/View.pm 2007/11/29 19:32:41 12 @@ -8,11 +8,13 @@ use Data::Dump qw/dump/; template '/pictures' => page { - h1 { _("Pictures available in system") }; my $fc = Arh::Model::PictureCollection->new; $fc->unlimit; my $present; form { + if ( $fc->count ) { + h1 { _("Pictures available in system") }; + } table { while ( my $f = $fc->next ) { $present->{ $f->filename }++; @@ -20,26 +22,30 @@ my $update = new_action( class => 'UpdatePicture', record => $f ); row { cell { + attr { class => 'picture' }; img { attr { src => "static/pics/" . $f->filename } } div { tt{ $f->filename } } } cell { + attr { class => 'picture-description' }; render_param( $update => 'campaign', render_mode => 'read' ); render_param( $update => 'type', render_mode => 'read' ); - div { - $delete->button( - submit => $delete, - label => _('Delete'), - arguments => { - id => $f->id, - } - ) + if ( $f->current_user_can('write') ) { + div { + $delete->button( + submit => $delete, + label => _('Delete'), + arguments => { + id => $f->id, + } + ) + } } } } } row { - cell { attr { colspan => 4 } outs _('Pending pictures') } + cell { attr { colspan => 2 } h1 { _('Pending pictures') } } }; warn "## present = ",dump( $present ); foreach my $f ( Arh::Model::Picture->all_filenames ) { @@ -47,10 +53,12 @@ my $create = new_action( class => 'CreatePicture' ); row { cell { + attr { class => 'picture' }; img { attr { src => "static/pics/$f" } } div { tt{ $f } } } cell { + attr { class => 'picture-description' }; render_param( $create => 'campaign' ); render_param( $create => 'type' ); $create->button(