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; |
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 { |
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 |
} |
} |
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 { |
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") }; |
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 |
}; |
}; |