Catalyst-ActionRole-Tabs
view release on metacpan or search on metacpan
lib/Catalyst/ActionRole/Tabs.pm view on Meta::CPAN
}
# edit action has a tab
sub edit : Local Does(Tabs) Tab {
...
$form->action($c->uri_for('update'));
...
}
# update action uses same tab as edit action
sub update : Local Does(Tabs) TabAlias(edit) {
...
if ($form->result->has_errors) {
$stash->{template} = 'edit.tt2';
}
else {
$c->response->redirect($c->uri_for('view'));
}
[% # Tab template %]
lib/Catalyst/ActionRole/Tabs.pm view on Meta::CPAN
form fields and then point the form's action to C<update>, where the
actual input processing happens. In case of an error, the same form
(decorated with some error messages) would be shown again, but this time
under C<.../update>. With C<TabAlias> C<update> shows the same tab as
C<edit>:
# action 'edit' has a Tab with label "Edit"
sub edit : Local Does(Tabs) Tab { ... }
# action 'update' has a Tab with label "Edit" too
sub update : Local Does(Tabs) TabAlias(edit) { ... }
=head1 METHODS
Normaly you never have to touch the following two methods.
They are documented here to reveal their purpose.
=head2 BUILD
C<BUILD> is a standard L<Moose|Moose> method, that is called at the end of
the object construction process.
t/lib/TestApp/Controller/Root.pm view on Meta::CPAN
}
sub edit :
Local
Does(Tabs) Tab
{
my ($self, $c) = @_;
$c->response->body("action: edit");
}
sub update :
Local
Does(Tabs) TabAlias(edit)
{
my ($self, $c) = @_;
$c->response->body("action: update");
}
sub remove :
Local
Does(Tabs) Tab
t/lib/TestChained/Controller/Test.pm view on Meta::CPAN
}
sub edit :
PathPart Chained(id) Args(0)
Does(Tabs) Tab
{
my ($self, $c) = @_;
$c->stash->{msg} .= '-edit';
}
sub update :
PathPart Chained(id) Args(0)
Does(Tabs) TabAlias(edit)
{
my ($self, $c) = @_;
$c->stash->{msg} .= '-update';
}
sub remove :
PathPart Chained(id) Args(0)
Does(Tabs) Tab
( run in 0.365 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )