1 package Reaction::UI::Controller::Role::Action::View;
3 use Moose::Role -traits => 'MethodAttributes';
4 use Reaction::UI::ViewPort::Object;
6 requires 'setup_viewport';
8 sub view :Action :Args(0) {
10 $self->setup_viewport($c, { model => $c->stash->{object} });
13 around _build_action_viewport_map => sub {
15 my $map = shift->$orig( @_ );
16 $map->{view} = 'Reaction::UI::ViewPort::Object';
26 Reaction::UI::Controller::Role::Action::View - View action
30 Provides a C<view> action, which sets up an L<Object Viewport|Reaction::UI::Viewport::Object>
31 using the object located in the C<object> slot of the C<stash>.
35 package MyApp::Controller::Foo;
37 use base 'Reaction::Controller';
41 'Reaction::UI::Controller::Role::GetCollection',
42 'Reaction::UI::Controller::Role::Action::Simple',
43 'Reaction::UI::Controller::Role::Action::Object',
44 'Reaction::UI::Controller::Role::Action::View'
47 __PACKAGE__->config( action => {
48 object => { Chained => 'base' },
49 view => { Chained => 'object' },
52 sub base :Chained('/base') :CaptureArgs(0) {
59 This role also consumes the following roles:
63 =item L<Reaction::UI::Controller::Role::Action::Simple>
71 Chain endpoint with no args, sets up the viewport with the appropriate viewport.
75 =head2 _build_action_viewport_map
77 Extends to set the C<view> key in the map to L<Reaction::UI::ViewPort::Object>
83 =item L<Reaction::UI::Controller>
85 =item L<Reaction::UI::Controller::Role::GetCollection>
87 =item L<Reaction::UI::Controller::Role::Action::Simple>
89 =item L<Reaction::UI::Controller::Role::Action::List>
91 =item L<Reaction::UI::Controller::Role::Action::Object>
93 =item L<Reaction::UI::Controller::Role::Action::Create>
95 =item L<Reaction::UI::Controller::Role::Action::Update>
97 =item L<Reaction::UI::Controller::Role::Action::Delete>
99 =item L<Reaction::UI::Controller::Role::Action::DeleteAll>
105 See L<Reaction::Class> for authors.
109 See L<Reaction::Class> for the license.