Commit | Line | Data |
7adfd53f |
1 | package ComponentUI::Controller::TestModel::Bar; |
2 | |
89b70ba7 |
3 | use base 'Reaction::UI::Controller::Collection::CRUD'; |
7adfd53f |
4 | use Reaction::Class; |
5 | |
6 | __PACKAGE__->config( |
a4f82080 |
7 | model_name => 'TestModel', |
8 | collection_name => 'Bar', |
599c1172 |
9 | action => { |
10 | base => { Chained => '/base', PathPart => 'testmodel/bar' }, |
c1b16a7d |
11 | list => { |
12 | ViewPort => { |
13 | enable_order_by => [qw/name foo published_at/], |
14 | coerce_order_by => { foo => ['foo.last_name', 'foo.first_name'] }, |
15 | } |
16 | } |
599c1172 |
17 | }, |
7adfd53f |
18 | ); |
19 | |
c1b16a7d |
20 | sub get_collection { |
21 | my ($self, $c) = @_; |
22 | my $collection = $self->next::method($c); |
23 | return $collection->where({}, { prefetch => 'foo' }); |
24 | } |
25 | |
7b5e71ad |
26 | sub create :Chained('base') { |
27 | my $self = shift; |
28 | my ($c) = @_; |
29 | my $action_vp = $self->next::method(@_); |
30 | my $self_uri = $c->uri_for($self->action_for('create')); |
31 | $action_vp->action($self_uri); |
32 | return $action_vp; |
33 | } |
34 | |
7adfd53f |
35 | 1; |