/[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 23 by dpavlin, Fri Nov 30 23:23:14 2007 UTC revision 34 by dpavlin, Fri Dec 14 14:39:05 2007 UTC
# Line 7  use Jifty::View::Declare -base; Line 7  use Jifty::View::Declare -base;
7    
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9    
10  template '/pictures' => page {  template 'pictures' => page {
11          my $fc = Arh::Model::PictureCollection->new;          my $fc = Arh::Model::PictureCollection->new;
12          $fc->unlimit;          $fc->unlimit;
13          my $present;          my $present;
# Line 25  template '/pictures' => page { Line 25  template '/pictures' => page {
25                                  row {                                  row {
26                                          cell {                                          cell {
27                                                  attr { class => 'picture' };                                                  attr { class => 'picture' };
28                                                  img { attr { src => "static/pics/" . $f->filename } }                                                  img { attr { src => "/static/pics/" . $f->filename } }
29                                                  div { tt{ $f->filename } }                                                  div { tt{ $f->filename } }
30                                          }                                          }
31                                          cell {                                          cell {
# Line 36  template '/pictures' => page { Line 36  template '/pictures' => page {
36                                                          div {                                                          div {
37                                                                  $delete->button(                                                                  $delete->button(
38                                                                          submit => $delete,                                                                          submit => $delete,
39                                                                          label => _('Delete'),                                                                          label => _('Delete picture'),
40                                                                          arguments => {                                                                          arguments => {
41                                                                                  id => $f->id,                                                                                  id => $f->id,
42                                                                          }                                                                          }
# Line 58  template '/pictures' => page { Line 58  template '/pictures' => page {
58                                          row {                                          row {
59                                                  cell {                                                  cell {
60                                                          attr { class => 'picture' };                                                          attr { class => 'picture' };
61                                                          img { attr { src => "static/pics/$f" } }                                                          img { attr { src => "/static/pics/$f" } }
62                                                          div { tt{ $f } }                                                          div { tt{ $f } }
63                                                  }                                                  }
64                                                  cell {                                                  cell {
# Line 83  template '/pictures' => page { Line 83  template '/pictures' => page {
83    
84  use Jifty::View::Declare::CRUD;  use Jifty::View::Declare::CRUD;
85  Jifty::View::Declare::CRUD->mount_view('materials');  Jifty::View::Declare::CRUD->mount_view('materials');
86    Jifty::View::Declare::CRUD->mount_view('UnitPictures');
 use Jifty::View::Declare::CRUD;  
87  Jifty::View::Declare::CRUD->mount_view('units');  Jifty::View::Declare::CRUD->mount_view('units');
88    #Jifty::View::Declare::CRUD->mount_view('locations');
89    
90  template '/units' => page {  template '/units' => page {
91          h1 { _("Units available in system") };          h1 { _("Units available in system") };
# Line 106  template '/units' => page { Line 106  template '/units' => page {
106    
107  };  };
108    
109  private template '/toggle_edit' => sub {  template 'toggle_edit' => sub {
110          my $self = shift;          my $self = shift;
111    
112          # no fun for anonymous users          my $toggleedit = new_action(
113          return unless $self->current_user->id;                  class => 'ToggleEdit',
114    #               moniker => 'toggle-edit',
         render_region(  
                 name => 'toggle-edit',  
                 path => '/toggle_edit_region',  
115          );          );
116    
 };  
   
 template 'toggle_edit_region' => sub {  
         my $self = shift;  
   
         my $toggleedit = new_action( class => 'ToggleEdit' );  
   
117          my $label = $self->current_user->editing ? _("Disable editing") : _("Enable editing");          my $label = $self->current_user->editing ? _("Disable editing") : _("Enable editing");
118    
119          warn "## $label\n";          warn "## $label\n";
120    
121          form {          form {
122                  hyperlink(                  outs_raw( $toggleedit->button(
123                          label => $label,                          label => $label,
124                          onclick => {                          submit => $toggleedit,
125                                  submit => $toggleedit,                  ));
                                 refresh_self => 1,  
                         },  
                 )  
126          }          }
127    
128  };  };

Legend:
Removed from v.23  
changed lines
  Added in v.34

  ViewVC Help
Powered by ViewVC 1.1.26