--- lib/Arh/View/Materials.pm 2007/11/30 16:46:39 15 +++ lib/Arh/View/Materials.pm 2007/11/30 17:16:34 16 @@ -20,6 +20,35 @@ return ('unit','material'); } +template 'list' => sub { + my $self = shift; + + my ( $page, $unit ) = get(qw(page unit)); + my $item_path = get('item_path') || $self->fragment_for("view"); + my $fragment_for_new_item = get('fragment_for_new_item') || $self->fragment_for('new_item'); + my $collection = $self->_current_collection(); + # XXX show just materials from current unit + $collection->limit( column => 'unit', value => $unit ) if $unit; + div { + { class is 'materials' }; + + show('./search_region'); + show( './paging_top', $collection, $page ); + show( './list_items', $collection, $item_path ); + show( './paging_bottom', $collection, $page ); + + render_region( + name => 'new_item', + path => $fragment_for_new_item, + defaults => { + object_type => $self->object_type, + unit => $unit, + }, + ); + } + +}; + template 'view' => sub :CRUDView { my $self = shift; my $record = $self->_get_record( get('id') ); @@ -67,7 +96,7 @@ { submit => $create, args => { -# unit => $unit, + unit => $unit, }, }, { refresh_self => 1 }, @@ -77,7 +106,6 @@ args => { object_type => $object_type, id => { result_of => $create, name => 'id' }, -# unit => $unit, }, }, ],