6 |
use base 'Jifty::View::Declare::CRUD'; |
use base 'Jifty::View::Declare::CRUD'; |
7 |
use Jifty::View::Declare -base; |
use Jifty::View::Declare -base; |
8 |
|
|
9 |
|
use Data::Dump qw/dump/; |
10 |
|
|
11 |
sub object_type { 'Unit' }; |
sub object_type { 'Unit' }; |
12 |
|
|
13 |
sub display_columns { |
sub display_columns { |
14 |
my $self = shift; |
my $self = shift; |
15 |
return ( qw/name inv_id campaign material dimensions discovered_at description chronology location/ ); |
return ( qw/ |
16 |
|
unit_id |
17 |
|
name |
18 |
|
subcategory |
19 |
|
category |
20 |
|
site |
21 |
|
gps |
22 |
|
placement |
23 |
|
context |
24 |
|
discovery |
25 |
|
function |
26 |
|
reusage |
27 |
|
ownership |
28 |
|
presevation_place |
29 |
|
inventory_nr |
30 |
|
dimensions |
31 |
|
condition |
32 |
|
toplogy |
33 |
|
technique |
34 |
|
description |
35 |
|
construction |
36 |
|
iconography |
37 |
|
decoration |
38 |
|
motifs |
39 |
|
inscription |
40 |
|
language |
41 |
|
font |
42 |
|
author |
43 |
|
chronology |
44 |
|
chronostyle |
45 |
|
explored |
46 |
|
conservations |
47 |
|
restorations |
48 |
|
legal |
49 |
|
links |
50 |
|
sources |
51 |
|
bibliography |
52 |
|
copyright |
53 |
|
material |
54 |
|
/ ); |
55 |
} |
} |
56 |
|
|
57 |
#private template search_region => sub {}; |
#private template search_region => sub {}; |
73 |
$editing = 0 unless $self->current_user->editing; |
$editing = 0 unless $self->current_user->editing; |
74 |
warn "## editing ",$editing ? 'ok' : 'DENIED'; |
warn "## editing ",$editing ? 'ok' : 'DENIED'; |
75 |
|
|
76 |
|
div { { class is 'unit' } |
77 |
|
|
78 |
if ( $editing ) { |
if ( $editing ) { |
79 |
form { |
form { |
80 |
outs_raw($delete->button( |
outs_raw($delete->button( |
81 |
label => _('Delete'), |
label => _('Delete unit'), |
82 |
class => 'float-crud-button', |
class => 'float-crud-button button-delete', |
83 |
onclick => { |
onclick => { |
84 |
submit => $delete, |
submit => $delete, |
85 |
confirm => _('Really delete?'), |
confirm => _('Really delete?'), |
92 |
}; |
}; |
93 |
}; |
}; |
94 |
|
|
95 |
|
|
96 |
form { |
form { |
97 |
foreach my $f ( $self->display_columns ) { |
foreach my $f ( $self->display_columns ) { |
98 |
if ( $f eq 'material' ) { |
if ( $f eq 'material' ) { |
107 |
); |
); |
108 |
} else { |
} else { |
109 |
my %opt; |
my %opt; |
110 |
$opt{render_mode} = 'read' if ! $editing; |
if ( ! $editing ) { |
111 |
|
$opt{render_mode} = 'read'; |
112 |
|
# skip fields without values |
113 |
|
$opt{render_as} = 'hidden' if ! defined( $update->record->$f ); |
114 |
|
} |
115 |
render_param( $update => $f, %opt ); |
render_param( $update => $f, %opt ); |
116 |
} |
} |
117 |
}; |
}; |
128 |
}; |
}; |
129 |
} |
} |
130 |
}; |
}; |
131 |
|
|
132 |
|
}; # div class unit |
133 |
|
|
134 |
|
show('/unitpictures/fragment', $record); |
135 |
|
|
136 |
hr {}; |
hr {}; |
137 |
}; |
}; |
138 |
|
|
149 |
form { |
form { |
150 |
|
|
151 |
foreach my $f ( $self->display_columns ) { |
foreach my $f ( $self->display_columns ) { |
152 |
|
# last if $f eq 'material' && ! $id; |
153 |
render_param( $create => $f ) unless $f eq 'material'; |
render_param( $create => $f ) unless $f eq 'material'; |
154 |
|
#warn "## $f"; |
155 |
} |
} |
156 |
|
|
157 |
div { |
div { |
161 |
onclick => [ |
onclick => [ |
162 |
{ |
{ |
163 |
submit => $create, |
submit => $create, |
164 |
# args => { |
# args => { |
165 |
# }, |
# }, |
166 |
}, |
}, |
167 |
{ refresh_self => 1 }, |
{ refresh_self => 1 }, |
168 |
{ |
{ |