/[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 29 by dpavlin, Mon Dec 10 15:16:52 2007 UTC revision 48 by dpavlin, Sun Apr 6 16:09:03 2008 UTC
# Line 88  template 'new_picture' => sub { Line 88  template 'new_picture' => sub {
88          return unless $self->current_user->editing;          return unless $self->current_user->editing;
89    
90          my ( $id, $unit ) = get(qw(id unit));          my ( $id, $unit ) = get(qw(id unit));
91          my $record_class = $self->record_class;          warn "## unit $id $unit";
92          my $create = $record_class->as_create_action(  
93    #       my $record_class = $self->record_class;
94    #       warn "## new_picture record_class: $record_class\n";
95    #       my $create = $record_class->as_create_action(
96    
97            my $create = new_action(
98                    class => 'UploadPicture',
99                  moniker => "create-" . Jifty->web->serial,                  moniker => "create-" . Jifty->web->serial,
100          );          );
         warn "## unit $unit";  
101    
102          my $attach_to =          my $attach_to =
103                  Jifty->web->current_region->parent ?                  Jifty->web->current_region->parent ?
# Line 102  template 'new_picture' => sub { Line 107  template 'new_picture' => sub {
107          warn "## attach_to = $attach_to";          warn "## attach_to = $attach_to";
108    
109      form {      form {
110                  render_param($create => 'picture');                  render_action( $create => [ 'campaign', 'content', 'type' ] );
111                  outs_raw( $create->hidden( unit => $unit ) );                  outs_raw( $create->hidden( unit => $unit ) );
112                  hyperlink(                  hyperlink(
113                          label   => _("Add picture"),                          label   => _("Add picture"),
# Line 130  template 'new_picture' => sub { Line 135  template 'new_picture' => sub {
135  template 'fragment' => sub {  template 'fragment' => sub {
136          my ( $self, $unit ) = @_;          my ( $self, $unit ) = @_;
137    
138          warn "## unit = ", dump( $unit );          #warn "## unit = ", dump( $unit );
139    
140          my $unitpictures = Arh::Model::UnitPictureCollection->new;          my $unitpictures = Arh::Model::UnitPictureCollection->new;
141          $unitpictures->limit( column => 'unit', value => $unit->id );          $unitpictures->limit( column => 'unit', value => $unit->id );
# Line 138  template 'fragment' => sub { Line 143  template 'fragment' => sub {
143    
144          div {          div {
145                  { class is 'pictures-by-unit' };                  { class is 'pictures-by-unit' };
146            
147                  em { 'pictures for unit ', $unit->name };                  if ( $unitpictures->count ) {
148                            em { _('Pictures for unit'), ' ', $unit->name };
149                    } else {
150                            em { _('No pictures for unit'), ' ', $unit->name };
151                    }
152    
153                  set( search_collection => $unitpictures );                  set( search_collection => $unitpictures );
154                  render_region(                  render_region(
# Line 150  template 'fragment' => sub { Line 159  template 'fragment' => sub {
159                                  unit => $unit->id,                                  unit => $unit->id,
160                          }                          }
161                  );                  );
162    
163          }          }
164  };  };
165    

Legend:
Removed from v.29  
changed lines
  Added in v.48

  ViewVC Help
Powered by ViewVC 1.1.26