20 |
return ('unit','material'); |
return ('unit','material'); |
21 |
} |
} |
22 |
|
|
23 |
|
template 'list' => sub { |
24 |
|
my $self = shift; |
25 |
|
|
26 |
|
my ( $page, $unit ) = get(qw(page unit)); |
27 |
|
my $item_path = get('item_path') || $self->fragment_for("view"); |
28 |
|
my $fragment_for_new_item = get('fragment_for_new_item') || $self->fragment_for('new_item'); |
29 |
|
my $collection = $self->_current_collection(); |
30 |
|
# XXX show just materials from current unit |
31 |
|
$collection->limit( column => 'unit', value => $unit ) if $unit; |
32 |
|
div { |
33 |
|
{ class is 'materials' }; |
34 |
|
|
35 |
|
show('./search_region'); |
36 |
|
show( './paging_top', $collection, $page ); |
37 |
|
show( './list_items', $collection, $item_path ); |
38 |
|
show( './paging_bottom', $collection, $page ); |
39 |
|
|
40 |
|
render_region( |
41 |
|
name => 'new_item', |
42 |
|
path => $fragment_for_new_item, |
43 |
|
defaults => { |
44 |
|
object_type => $self->object_type, |
45 |
|
unit => $unit, |
46 |
|
}, |
47 |
|
); |
48 |
|
} |
49 |
|
|
50 |
|
}; |
51 |
|
|
52 |
template 'view' => sub :CRUDView { |
template 'view' => sub :CRUDView { |
53 |
my $self = shift; |
my $self = shift; |
54 |
my $record = $self->_get_record( get('id') ); |
my $record = $self->_get_record( get('id') ); |
96 |
{ |
{ |
97 |
submit => $create, |
submit => $create, |
98 |
args => { |
args => { |
99 |
# unit => $unit, |
unit => $unit, |
100 |
}, |
}, |
101 |
}, |
}, |
102 |
{ refresh_self => 1 }, |
{ refresh_self => 1 }, |
106 |
args => { |
args => { |
107 |
object_type => $object_type, |
object_type => $object_type, |
108 |
id => { result_of => $create, name => 'id' }, |
id => { result_of => $create, name => 'id' }, |
|
# unit => $unit, |
|
109 |
}, |
}, |
110 |
}, |
}, |
111 |
], |
], |