diff options
Diffstat (limited to 'lib/ComponentUI/Controller')
-rw-r--r-- | lib/ComponentUI/Controller/Root.pm | 5 | ||||
-rw-r--r-- | lib/ComponentUI/Controller/TestModel/Bar.pm | 21 | ||||
-rw-r--r-- | lib/ComponentUI/Controller/TestModel/Baz.pm | 5 | ||||
-rw-r--r-- | lib/ComponentUI/Controller/TestModel/Foo.pm | 20 |
4 files changed, 32 insertions, 19 deletions
diff --git a/lib/ComponentUI/Controller/Root.pm b/lib/ComponentUI/Controller/Root.pm index 9a2017f..bc45f33 100644 --- a/lib/ComponentUI/Controller/Root.pm +++ b/lib/ComponentUI/Controller/Root.pm @@ -2,8 +2,9 @@ package ComponentUI::Controller::Root; use strict; use warnings; -use base 'Reaction::UI::Controller::Root'; -use Reaction::Class; + +use Moose; +BEGIN { extends 'Reaction::UI::Controller::Root'; } use aliased 'Reaction::UI::ViewPort'; use aliased 'Reaction::UI::ViewPort::SiteLayout'; diff --git a/lib/ComponentUI/Controller/TestModel/Bar.pm b/lib/ComponentUI/Controller/TestModel/Bar.pm index 4701fff..6c1118c 100644 --- a/lib/ComponentUI/Controller/TestModel/Bar.pm +++ b/lib/ComponentUI/Controller/TestModel/Bar.pm @@ -1,7 +1,7 @@ package ComponentUI::Controller::TestModel::Bar; -use base 'Reaction::UI::Controller::Collection::CRUD'; -use Reaction::Class; +use Moose; +BEGIN { extends 'Reaction::UI::Controller::Collection::CRUD'; } __PACKAGE__->config( model_name => 'TestModel', @@ -16,17 +16,22 @@ __PACKAGE__->config( layout => 'bar/collection', member_class => 'Reaction::UI::ViewPort::Object', Member => { layout => 'bar/member' } - } - } + }, + }, }, ); -sub get_collection { - my ($self, $c) = @_; - my $collection = $self->next::method($c); +around get_collection => sub { + my ($orig, $self, $c) = @_; + my $collection = $self->$orig($c); return $collection->where({}, { prefetch => 'foo' }); -} +}; + +1; + +__END__; +#put this aside for now sub create :Chained('base') { my $self = shift; my ($c) = @_; diff --git a/lib/ComponentUI/Controller/TestModel/Baz.pm b/lib/ComponentUI/Controller/TestModel/Baz.pm index 6c88792..f5ff875 100644 --- a/lib/ComponentUI/Controller/TestModel/Baz.pm +++ b/lib/ComponentUI/Controller/TestModel/Baz.pm @@ -1,7 +1,8 @@ package ComponentUI::Controller::TestModel::Baz; -use base 'Reaction::UI::Controller::Collection::CRUD'; -use Reaction::Class; +use Moose; +BEGIN { extends 'Reaction::UI::Controller::Collection::CRUD'; } + use ComponentUI::UI::ViewPort::Baz::ListView::Member; __PACKAGE__->config( diff --git a/lib/ComponentUI/Controller/TestModel/Foo.pm b/lib/ComponentUI/Controller/TestModel/Foo.pm index d636c6c..50dccde 100644 --- a/lib/ComponentUI/Controller/TestModel/Foo.pm +++ b/lib/ComponentUI/Controller/TestModel/Foo.pm @@ -1,7 +1,7 @@ package ComponentUI::Controller::TestModel::Foo; -use base 'Reaction::UI::Controller::Collection::CRUD'; -use Reaction::Class; +use Moose; +BEGIN { extends 'Reaction::UI::Controller::Collection::CRUD'; } use aliased 'Reaction::UI::ViewPort::SearchableListViewContainer'; use aliased 'ComponentUI::TestModel::Foo::SearchSpec'; @@ -56,16 +56,22 @@ for my $action (qw/view create update/){ override _build_action_viewport_map => sub { my $map = super(); $map->{list} = SearchableListViewContainer; - $map; + return $map; }; -sub _build_action_viewport_args { - my $self = shift; - my $args = $self->next::method(@_); - $args->{list}{action_prototypes}{delete_all}{label} = 'Delete All Records'; +override _build_action_viewport_args => sub { + my $args = super(); $args->{list}{spec_class} = SearchSpec; $args->{list}{action_class} = Update; return $args; +}; + +sub object : Chained('base') PathPart('id') CaptureArgs(1) { + my ($self, $c, $object) = @_; + $self->next::method($c, $object); + # just as failing use case } 1; + +__END__; |