/[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

Diff of /lib/Arh/View.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 7 by dpavlin, Thu Nov 29 15:13:10 2007 UTC revision 15 by dpavlin, Fri Nov 30 16:46:39 2007 UTC
# Line 8  use Jifty::View::Declare -base; Line 8  use Jifty::View::Declare -base;
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 }++;
21                                  my $delete = new_action( class => 'DeletePicture' );                                  my $delete = new_action( class => 'DeletePicture' );
22                                    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                                                  ul {                                                  attr { class => 'picture-description' };
31                                                          li { _("Part of campaign"), ': ',  $f->campaign->name; }                                                  render_param( $update => 'campaign', render_mode => 'read' );
32                                                          li { _("Type of picture"), ': ', $f->type->name }                                                  render_param( $update => 'type', render_mode => 'read' );
33                                                          div { $delete->button(                                                  if ( $f->current_user_can('write') ) {
34                                                            div {
35                                                                    $delete->button(
36                                                                          submit => $delete,                                                                          submit => $delete,
37                                                                          label => _('Delete'),                                                                          label => _('Delete'),
38                                                                          arguments => {                                                                          arguments => {
# Line 38  template '/pictures' => page { Line 44  template '/pictures' => page {
44                                          }                                          }
45                                  }                                  }
46                          }                          }
47                          row {                          warn "current_user->id: ",current_user->id;
48                                  cell { attr { colspan => 4 } outs _('Pending pictures') }                          if ( current_user->id ) {
                         };  
                         warn "## present = ",dump( $present );  
                         foreach my $f ( Arh::Model::Picture->all_filenames ) {  
                                 next if $present->{$f};  
                                 my $create = new_action( class => 'CreatePicture' );  
49                                  row {                                  row {
50                                          cell {                                          cell { attr { colspan => 2 } h1 { _('Pending pictures') } }
51                                                  img { attr { src => "static/pics/$f" } }                                  };
52                                                  div { tt{ $f } }                                  warn "## present = ",dump( $present );
53                                          }                                  foreach my $f ( Arh::Model::Picture->all_filenames ) {
54                                          cell {                                          next if $present->{$f};
55                                                  render_param( $create => 'campaign' );                                          my $create = new_action( class => 'CreatePicture' );
56                                                  render_param( $create => 'type' );                                          row {
57                                                  $create->button(                                                  cell {
58                                                          submit => $create,                                                          attr { class => 'picture' };
59                                                          label => _('Add'),                                                          img { attr { src => "static/pics/$f" } }
60                                                          arguments => {                                                          div { tt{ $f } }
61                                                                  filename => $f,                                                  }
62                                                          }                                                  cell {
63                                                  );                                                          attr { class => 'picture-description' };
64                                                            render_param( $create => 'campaign' );
65                                                            render_param( $create => 'type' );
66                                                            $create->button(
67                                                                    submit => $create,
68                                                                    label => _('Add'),
69                                                                    arguments => {
70                                                                            filename => $f,
71                                                                    }
72                                                            );
73                                                    }
74                                          }                                          }
75                                  }                                  }
76                          }                          }
# Line 68  template '/pictures' => page { Line 79  template '/pictures' => page {
79    
80  };  };
81    
82    use Jifty::View::Declare::CRUD;
83    Jifty::View::Declare::CRUD->mount_view('materials');
84    
85    use Jifty::View::Declare::CRUD;
86    Jifty::View::Declare::CRUD->mount_view('units');
87    
88    template '/units' => page {
89            h1 { _("Units available in system") };
90    
91            my $search = Arh::Model::UnitCollection->new;
92            $search->unlimit;
93    
94            set( search_collection => $search );
95            render_region(
96                    name => 'units',
97                    path => '/units/list',
98                    defaults => {
99                            page => 1,
100                    }
101            );
102    
103    };
104    
105  1;  1;

Legend:
Removed from v.7  
changed lines
  Added in v.15

  ViewVC Help
Powered by ViewVC 1.1.26