Commit | Line | Data |
7adfd53f |
1 | package ComponentUI::Controller::TestModel::Foo; |
2 | |
26fa3b8a |
3 | use Moose; |
90bcd4d7 |
4 | BEGIN { extends 'Reaction::UI::Controller::Collection::CRUD'; } |
7adfd53f |
5 | |
13070d34 |
6 | use aliased 'Reaction::UI::ViewPort::SearchableListViewContainer'; |
7 | use aliased 'ComponentUI::TestModel::Foo::SearchSpec'; |
8 | use aliased 'ComponentUI::TestModel::Foo::Action::SearchSpec::Update'; |
9 | |
7adfd53f |
10 | __PACKAGE__->config( |
a4f82080 |
11 | model_name => 'TestModel', |
12 | collection_name => 'Foo', |
599c1172 |
13 | action => { |
14 | base => { Chained => '/base', PathPart => 'testmodel/foo' }, |
15 | list => { |
16 | ViewPort => { |
336b3bb0 |
17 | action_prototypes => { delete_all => 'Delete all records' }, |
599c1172 |
18 | excluded_fields => [qw/id/], |
37728bba |
19 | action_order => [qw/delete_all create/], |
c1b16a7d |
20 | enable_order_by => [qw/last_name/], |
37728bba |
21 | Member => { |
22 | action_order => [qw/view update delete/], |
23 | }, |
599c1172 |
24 | }, |
25 | }, |
26 | view => { |
27 | ViewPort => { |
28 | excluded_fields => [qw/id/], |
29 | }, |
30 | }, |
e29819c4 |
31 | delete => { |
32 | ViewPort => {message => 'Are you sure you want to delete this Foo?'} |
33 | }, |
599c1172 |
34 | }, |
7adfd53f |
35 | ); |
36 | |
599c1172 |
37 | for my $action (qw/view create update/){ |
38 | __PACKAGE__->config( |
39 | action => { |
40 | $action => { |
41 | ViewPort => { |
42 | container_layouts => [ |
43 | { name => 'primary', fields => [qw/first_name last_name/]}, |
44 | { |
45 | name => 'secondary', |
46 | label => 'Optional Label', |
47 | fields => [qw/bars bazes/], |
48 | }, |
49 | ], |
50 | }, |
51 | }, |
52 | } |
53 | ); |
54 | } |
55 | |
13070d34 |
56 | override _build_action_viewport_map => sub { |
57 | my $map = super(); |
58 | $map->{list} = SearchableListViewContainer; |
9bb62506 |
59 | return $map; |
13070d34 |
60 | }; |
61 | |
9bb62506 |
62 | override _build_action_viewport_args => sub { |
63 | my $args = super(); |
13070d34 |
64 | $args->{list}{spec_class} = SearchSpec; |
65 | $args->{list}{action_class} = Update; |
37728bba |
66 | return $args; |
9bb62506 |
67 | }; |
37728bba |
68 | |
58db82a4 |
69 | sub object : Chained('base') PathPart('id') CaptureArgs(1) { |
90bcd4d7 |
70 | my ($self, $c, $object) = @_; |
71 | $self->next::method($c, $object); |
72 | # just as failing use case |
58db82a4 |
73 | } |
74 | |
7adfd53f |
75 | 1; |
9bb62506 |
76 | |
77 | __END__; |