/[Arh]/lib/Arh/View/UnitPictures.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/UnitPictures.pm

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

revision 51 by dpavlin, Sun Apr 6 18:31:14 2008 UTC revision 64 by dpavlin, Mon Apr 7 15:50:57 2008 UTC
# Line 32  template 'list' => sub { Line 32  template 'list' => sub {
32      my $collection =  $self->_current_collection();      my $collection =  $self->_current_collection();
33          # XXX show just pictures from current unit          # XXX show just pictures from current unit
34          $collection->limit( column => 'unit', value => $unit ) if $unit;          $collection->limit( column => 'unit', value => $unit ) if $unit;
35    
36            warn "## list page: $page unit: $unit fragment_for_new_picture: $fragment_for_new_picture item_path: $item_path";
37    
38      div {      div {
39                  { class is 'pictures' };                  { class is 'pictures' };
40    
# Line 61  template 'view' => sub :CRUDView { Line 64  template 'view' => sub :CRUDView {
64                  moniker => "delete-" . Jifty->web->serial,                  moniker => "delete-" . Jifty->web->serial,
65          );          );
66    
67          warn "## id: $id unit $unit";          warn "## view id: $id unit $unit";
68    
69            div {
70                    { class is 'single-picture' };
71    
         form {  
72                  if ( $record->current_user_can('delete') && $self->current_user->editing ) {                  if ( $record->current_user_can('delete') && $self->current_user->editing ) {
73                            form {
74                          outs_raw( $delete->button(                          outs_raw( $delete->button(
75                                  label   => _("Delete picture"),                                  label   => _("Delete picture"),
76                                  class   => "float-crud-button button-delete",                                  class   => "float-crud-button button-delete",
# Line 76  template 'view' => sub :CRUDView { Line 82  template 'view' => sub :CRUDView {
82                                          args => { id => $id },                                          args => { id => $id },
83                                  },                                  },
84                          ));                          ));
85                            }
86                  };                  };
87                  img { attr { src => "/pictures/show/" . $record->filename } }  
88                  tt{ $record->filename }                  img { attr { src => "/static/pics/thumb/" . $record->thumbnail } };
89                    span { $record->type->name };
90                    tt { $record->filename };
91    
92          };          };
93    
94  };  };
# Line 92  template 'new_picture' => sub { Line 102  template 'new_picture' => sub {
102    
103          my $record_class = $self->record_class;          my $record_class = $self->record_class;
104          warn "## new_picture record_class: $record_class\n";          warn "## new_picture record_class: $record_class\n";
105          my $create = $record_class->as_create_action(  #       my $create = $record_class->as_create_action(
106            my $create = new_action(
107                    class => 'UploadPicture',
108                  moniker => "create-" . Jifty->web->serial,                  moniker => "create-" . Jifty->web->serial,
109          );          );
110    
# Line 105  template 'new_picture' => sub { Line 117  template 'new_picture' => sub {
117    
118      form {      form {
119                  render_action( $create => [ 'campaign', 'content', 'type' ] );                  render_action( $create => [ 'campaign', 'content', 'type' ] );
120                    outs_raw( $create->hidden( unit => $unit ) );
121                    form_submit( label => _('Add picture') );
122    =for firefox-only
123                  hyperlink(                  hyperlink(
124                          label   => _("Add picture"),                          label   => _("Add picture"),
125                          class   => "float-crud-button button-add",                          class   => "float-crud-button button-add",
126                          onclick => [                          onclick => [
127                                  {                                  {
128                                          submit => $create,                                          submit => $create,
                                         args => {  
                                                 unit => $unit,  
                                         }  
129                                  },                                  },
130                                  {       refresh_self => 1       },                                  {       refresh_self => 1       },
131                                  {                                  {
# Line 128  template 'new_picture' => sub { Line 140  template 'new_picture' => sub {
140                          ],                          ],
141                          as_button => 1,                          as_button => 1,
142                  );                  );
143    =cut
144      };      };
145  };  };
146    
# Line 146  template 'fragment' => sub { Line 159  template 'fragment' => sub {
159                  if ( $unitpictures->count ) {                  if ( $unitpictures->count ) {
160                          em { _('Pictures for unit'), ' ', $unit->name };                          em { _('Pictures for unit'), ' ', $unit->name };
161    
                         set( search_collection => $unitpictures );  
                         render_region(  
                                 name => 'unit-pictures',  
                                 path => '/unitpictures/list',  
                                 defaults => {  
                                         page => 1,  
                                         unit => $unit->id,  
                                 }  
                         );  
   
162                  } else {                  } else {
163                          em { _('No pictures for unit'), ' ', $unit->name };                          em { _('No pictures for unit'), ' ', $unit->name };
164                  }                  }
165    
166                    set( search_collection => $unitpictures );
167    
168                    render_region(
169                            name => 'unit-pictures',
170                            path => '/unitpictures/list',
171                            defaults => {
172                                    page => 1,
173                                    unit => $unit->id,
174                            }
175                    );
176    
177          }          }
178  };  };
179    

Legend:
Removed from v.51  
changed lines
  Added in v.64

  ViewVC Help
Powered by ViewVC 1.1.26