« blib/lib/CatalystX/Resource/TraitFor/Controller/Resource/Delete.pm
↑ Summary
blib/lib/CatalystX/Resource/TraitFor/Controller/Resource/List.pm »
| 1 | package CatalystX::Resource::TraitFor::Controller::Resource::Edit; | ||
| 2 | $CatalystX::Resource::TraitFor::Controller::Resource::Edit::VERSION = '0.009_002'; | ||
| 3 | use MooseX::MethodAttributes::Role; | ||
| 4 | use namespace::autoclean; | ||
| 5 | |||
| 6 | # ABSTRACT: a edit action for your resource | ||
| 7 | |||
| 8 | requires qw/ | ||
| 9 | form | ||
| 10 | /; | ||
| 11 | |||
| 12 | |||
| 13 | |||
| 14 | has 'activate_fields_edit' => ( | ||
| 15 | is => 'ro', | ||
| 16 | isa => 'ArrayRef', | ||
| 17 | default => sub { [] }, | ||
| 18 | ); | ||
| 19 | |||
| 20 | |||
| 21 | sub edit : Method('GET') Method('POST') Chained('base_with_id') PathPart('edit') Args(0) { | ||
| 22 | my ( $self, $c ) = @_; | ||
| 23 | $c->stash( set_update_msg => 1 ); | ||
| 24 | $self->form( $c, $self->activate_fields_edit ); | ||
| 25 | } | ||
| 26 | |||
| 27 | |||
| 28 | 1; | ||
| 29 | |||
| 30 | __END__ | ||
| 31 | |||
| 32 | =pod | ||
| 33 | |||
| 34 | =encoding UTF-8 | ||
| 35 | |||
| 36 | =head1 NAME | ||
| 37 | |||
| 38 | CatalystX::Resource::TraitFor::Controller::Resource::Edit - a edit action for your resource | ||
| 39 | |||
| 40 | =head1 VERSION | ||
| 41 | |||
| 42 | version 0.009_002 | ||
| 43 | |||
| 44 | =head1 ATTRIBUTES | ||
| 45 | |||
| 46 | =head2 activate_fields_edit | ||
| 47 | |||
| 48 | arrayref of form fields to activate in the edit form | ||
| 49 | (default = []). | ||
| 50 | Can be overriden with $c->stash->{activate_form_fields} | ||
| 51 | |||
| 52 | =head1 ACTIONS | ||
| 53 | |||
| 54 | =head2 edit | ||
| 55 | |||
| 56 | edit a specific resource | ||
| 57 | |||
| 58 | =head1 AUTHOR | ||
| 59 | |||
| 60 | David Schmidt <davewood@cpan.org> | ||
| 61 | |||
| 62 | =head1 COPYRIGHT AND LICENSE | ||
| 63 | |||
| 64 | This software is copyright (c) 2011 by David Schmidt. | ||
| 65 | |||
| 66 | This is free software; you can redistribute it and/or modify it under | ||
| 67 | the same terms as the Perl 5 programming language system itself. | ||
| 68 | |||
| 69 | =cut |