44 |
} |
} |
45 |
} |
} |
46 |
} |
} |
47 |
row { |
warn "current_user->id: ",current_user->id; |
48 |
cell { attr { colspan => 2 } h1 { _('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 |
attr { class => 'picture' }; |
}; |
52 |
img { attr { src => "static/pics/$f" } } |
warn "## present = ",dump( $present ); |
53 |
div { tt{ $f } } |
foreach my $f ( Arh::Model::Picture->all_filenames ) { |
54 |
} |
next if $present->{$f}; |
55 |
cell { |
my $create = new_action( class => 'CreatePicture' ); |
56 |
attr { class => 'picture-description' }; |
row { |
57 |
render_param( $create => 'campaign' ); |
cell { |
58 |
render_param( $create => 'type' ); |
attr { class => 'picture' }; |
59 |
$create->button( |
img { attr { src => "static/pics/$f" } } |
60 |
submit => $create, |
div { tt{ $f } } |
61 |
label => _('Add'), |
} |
62 |
arguments => { |
cell { |
63 |
filename => $f, |
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 |
} |
} |
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 { |
template '/units' => page { |
89 |
h1 { _("Units available in system") }; |
h1 { _("Units available in system") }; |
90 |
|
|
91 |
my $units = Arh::Model::UnitCollection->new; |
my $search = Arh::Model::UnitCollection->new; |
92 |
$units->unlimit; |
$search->unlimit; |
|
|
|
|
while ( my $u = $units->next ) { |
|
|
unit( $u ); |
|
|
} |
|
|
}; |
|
93 |
|
|
94 |
sub unit { |
set( search_collection => $search ); |
95 |
my $unit = shift || die "no unit?"; |
render_region( |
96 |
my $a = new_action( class => 'UpdateUnit', record => $unit ); |
name => 'units', |
97 |
warn "## current_user = ",dump( current_user ); |
path => '/units/list', |
98 |
form { |
defaults => { |
99 |
foreach my $f ( qw/name number campaign material dimensions position description chronology location/ ) { |
page => 1, |
|
if ( $f eq 'material' ) { |
|
|
my $material = $unit->material; |
|
|
while ( my $um = $material->next ) { |
|
|
my $m = new_action( class => 'UpdateMaterial', record => $um->material ); |
|
|
render_param( $m => 'name', label => _("Material"), render_mode => 'read' ); |
|
|
} |
|
|
} else { |
|
|
my %opt; |
|
|
$opt{render_mode} = 'read'; # unless |
|
|
warn "write $f ",$unit->current_user_can('write',$f) ? 'ok' : 'DENIED'; |
|
|
render_param( $a => $f, %opt ); |
|
|
} |
|
100 |
} |
} |
101 |
} |
); |
102 |
} |
|
103 |
|
}; |
104 |
|
|
105 |
1; |
1; |