--- lib/Arh/View/Units.pm 2007/11/30 23:23:14 23 +++ lib/Arh/View/Units.pm 2008/04/07 15:03:03 63 @@ -6,11 +6,52 @@ use base 'Jifty::View::Declare::CRUD'; use Jifty::View::Declare -base; +use Data::Dump qw/dump/; + sub object_type { 'Unit' }; sub display_columns { my $self = shift; - return ( qw/name inv_id campaign material dimensions discovered_at description chronology location/ ); + return ( qw/ + unit_id + name + subcategory + category + site + gps + placement + context + discovery + function + reusage + ownership + presevation_place + inventory_nr + dimensions + condition + toplogy + technique + description + construction + iconography + decoration + motifs + inscription + language + font + author + chronology + chronostyle + explored + conservations + restorations + legal + links + sources + bibliography + copyright + material + / ); } #private template search_region => sub {}; @@ -32,12 +73,13 @@ $editing = 0 unless $self->current_user->editing; warn "## editing ",$editing ? 'ok' : 'DENIED'; + div { { class is 'unit' } if ( $editing ) { form { outs_raw($delete->button( - label => _('Delete'), - class => 'float-crud-button', + label => _('Delete unit'), + class => 'float-crud-button button-delete', onclick => { submit => $delete, confirm => _('Really delete?'), @@ -50,6 +92,7 @@ }; }; + form { foreach my $f ( $self->display_columns ) { if ( $f eq 'material' ) { @@ -64,7 +107,11 @@ ); } else { my %opt; - $opt{render_mode} = 'read' if ! $editing; + if ( ! $editing ) { + $opt{render_mode} = 'read'; + # skip fields without values + $opt{render_as} = 'hidden' if ! defined( $update->record->$f ); + } render_param( $update => $f, %opt ); } }; @@ -81,6 +128,11 @@ }; } }; + + }; # div class unit + + show('/unitpictures/fragment', $record); + hr {}; }; @@ -97,7 +149,9 @@ form { foreach my $f ( $self->display_columns ) { +# last if $f eq 'material' && ! $id; render_param( $create => $f ) unless $f eq 'material'; + #warn "## $f"; } div { @@ -107,8 +161,8 @@ onclick => [ { submit => $create, - # args => { - # }, +# args => { +# }, }, { refresh_self => 1 }, {