/[Arh]/lib/Arh/View.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /lib/Arh/View.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7 - (hide annotations)
Thu Nov 29 15:13:10 2007 UTC (16 years, 4 months ago) by dpavlin
File size: 1487 byte(s)
redesign output of pictures
1 dpavlin 6 package Arh::View;
2    
3     use strict;
4     use warnings;
5    
6     use Jifty::View::Declare -base;
7    
8     use Data::Dump qw/dump/;
9    
10     template '/pictures' => page {
11     h1 { _("Pictures available in system") };
12     my $fc = Arh::Model::PictureCollection->new;
13     $fc->unlimit;
14     my $present;
15     form {
16     table {
17     while ( my $f = $fc->next ) {
18     $present->{ $f->filename }++;
19     my $delete = new_action( class => 'DeletePicture' );
20     row {
21     cell {
22     img { attr { src => "static/pics/" . $f->filename } }
23     div { tt{ $f->filename } }
24     }
25     cell {
26 dpavlin 7 ul {
27     li { _("Part of campaign"), ': ', $f->campaign->name; }
28     li { _("Type of picture"), ': ', $f->type->name }
29     div { $delete->button(
30     submit => $delete,
31     label => _('Delete'),
32     arguments => {
33     id => $f->id,
34     }
35     )
36 dpavlin 6 }
37 dpavlin 7 }
38 dpavlin 6 }
39     }
40     }
41     row {
42     cell { attr { colspan => 4 } outs _('Pending pictures') }
43     };
44     warn "## present = ",dump( $present );
45     foreach my $f ( Arh::Model::Picture->all_filenames ) {
46     next if $present->{$f};
47     my $create = new_action( class => 'CreatePicture' );
48     row {
49     cell {
50     img { attr { src => "static/pics/$f" } }
51     div { tt{ $f } }
52     }
53     cell {
54 dpavlin 7 render_param( $create => 'campaign' );
55     render_param( $create => 'type' );
56 dpavlin 6 $create->button(
57     submit => $create,
58     label => _('Add'),
59     arguments => {
60     filename => $f,
61     }
62 dpavlin 7 );
63 dpavlin 6 }
64     }
65     }
66     }
67     }
68    
69     };
70    
71     1;

  ViewVC Help
Powered by ViewVC 1.1.26