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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 20 - (hide annotations)
Fri Nov 30 17:50:34 2007 UTC (16 years, 4 months ago) by dpavlin
File size: 1191 byte(s)
button is now in div submit_button, so it's positioned correctly
1 dpavlin 15 package Arh::View::Units;
2    
3     use strict;
4     use warnings;
5    
6     use base 'Jifty::View::Declare::CRUD';
7     use Jifty::View::Declare -base;
8    
9     sub object_type { 'Unit' };
10    
11     #private template search_region => sub {};
12    
13     template 'view' => sub :CRUDView {
14     my $self = shift;
15     my $record = $self->_get_record( get('id') );
16    
17     my $update = $record->as_update_action(
18     moniker => "update-" . Jifty->web->serial,
19     );
20    
21     my $can_write = $record->current_user_can('write');
22     #warn "write ",$can_write ? 'ok' : 'DENIED';
23    
24     form {
25     foreach my $f ( qw/name number campaign material dimensions position description chronology location/ ) {
26     if ( $f eq 'material' ) {
27     set( search_collection => $record->material );
28     render_region(
29     name => 'unit-materials',
30     path => '/materials/list',
31     defaults => {
32     page => 1,
33     unit => $record->id,
34     }
35     );
36     } else {
37     my %opt;
38     $opt{render_mode} = 'read' if ! $can_write;
39     render_param( $update => $f, %opt );
40     }
41     };
42 dpavlin 20 if ( $can_write ) {
43     div {
44     { class is 'submit_button' };
45     hyperlink(
46     label => _('Update'),
47     onclick => {
48     submit => $update,
49     refresh_self => 1,
50     },
51     )
52     };
53     }
54 dpavlin 15 };
55     hr {};
56     };
57    
58     1;

  ViewVC Help
Powered by ViewVC 1.1.26