completely new way of handling action prototypes for actions in CRUD that is much...
[catagits/Reaction.git] / lib / ComponentUI / Controller / TestModel / Foo.pm
1 package ComponentUI::Controller::TestModel::Foo;
2
3 use base 'Reaction::UI::Controller::Collection::CRUD';
4 use Reaction::Class;
5
6 __PACKAGE__->config(
7   model_name => 'TestModel',
8   collection_name => 'Foo',
9   action => {
10     base => { Chained => '/base', PathPart => 'testmodel/foo' },
11     list => {
12       ViewPort => {
13         excluded_fields => [qw/id/],
14         action_order => [qw/delete_all create/],
15         Member => {
16           action_order => [qw/view update delete/],
17         },
18       },
19     },
20     view => {
21       ViewPort => {
22         excluded_fields => [qw/id/],
23       },
24     },
25   },
26 );
27
28 for my $action (qw/view create update/){
29   __PACKAGE__->config(
30     action => {
31       $action => {
32         ViewPort => {
33           container_layouts => [
34             { name => 'primary', fields => [qw/first_name last_name/]},
35             {
36               name => 'secondary',
37               label => 'Optional Label',
38               fields => [qw/bars bazes/],
39             },
40           ],
41         },
42       },
43     }
44   );
45 }
46
47 sub _build_action_viewport_args {
48   my $self = shift;
49   my $args = $self->next::method(@_);
50   $args->{list}{action_prototypes}{delete_all}{label} = 'Delete All Records';
51   return $args;
52 }
53
54 1;