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