work arounds not necessary with newest MethodAttributes release (0.18)
[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         action_prototypes => { delete_all => 'Delete all records' },
14         excluded_fields => [qw/id/],
15         action_order => [qw/delete_all create/],
16         enable_order_by => [qw/last_name/],
17         Member => {
18           action_order => [qw/view update delete/],
19         },
20       },
21     },
22     view => {
23       ViewPort => {
24         excluded_fields => [qw/id/],
25       },
26     },
27     delete => {
28       ViewPort => {message => 'Are you sure you want to delete this Foo?'}
29     },
30   },
31 );
32
33 for my $action (qw/view create update/){
34   __PACKAGE__->config(
35     action => {
36       $action => {
37         ViewPort => {
38           container_layouts => [
39             { name => 'primary', fields => [qw/first_name last_name/]},
40             {
41               name => 'secondary',
42               label => 'Optional Label',
43               fields => [qw/bars bazes/],
44             },
45           ],
46         },
47       },
48     }
49   );
50 }
51
52 # sub _build_action_viewport_args {
53 #   my $self = shift;
54 #   my $args = $self->next::method(@_);
55 # #  $args->{list}{action_prototypes}{delete_all}{label} = 'Delete All Records';
56 #   return $args;
57 # }
58
59 1;