| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CatalystX::Resource::TraitFor::Controller::Resource::Create; |
|
2
|
|
|
|
|
|
|
$CatalystX::Resource::TraitFor::Controller::Resource::Create::VERSION = '0.03'; |
|
3
|
9
|
|
|
9
|
|
2705576
|
use MooseX::MethodAttributes::Role; |
|
|
9
|
|
|
|
|
25
|
|
|
|
9
|
|
|
|
|
123
|
|
|
4
|
9
|
|
|
9
|
|
503138
|
use namespace::autoclean; |
|
|
9
|
|
|
|
|
59
|
|
|
|
9
|
|
|
|
|
107
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: a create action for your resource |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
requires qw/ |
|
9
|
|
|
|
|
|
|
resultset_key |
|
10
|
|
|
|
|
|
|
resource_key |
|
11
|
|
|
|
|
|
|
form |
|
12
|
|
|
|
|
|
|
/; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'activate_fields_create' => ( |
|
16
|
|
|
|
|
|
|
is => 'ro', |
|
17
|
|
|
|
|
|
|
isa => 'ArrayRef', |
|
18
|
|
|
|
|
|
|
default => sub { [] }, |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub create : Method('GET') Method('POST') Chained('base') PathPart('create') Args(0) { |
|
23
|
23
|
|
|
23
|
1
|
11875
|
my ( $self, $c ) = @_; |
|
24
|
23
|
|
|
|
|
115
|
my $resource = $c->stash->{ $self->resultset_key }->new_result( {} ); |
|
25
|
23
|
|
|
|
|
6066
|
$c->stash( |
|
26
|
|
|
|
|
|
|
$self->resource_key => $resource, |
|
27
|
|
|
|
|
|
|
set_create_msg => 1, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
23
|
|
|
|
|
2781
|
$self->form( $c, $self->activate_fields_create ); |
|
30
|
9
|
|
|
9
|
|
2390
|
} |
|
|
9
|
|
|
|
|
27
|
|
|
|
9
|
|
|
|
|
111
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=encoding UTF-8 |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
CatalystX::Resource::TraitFor::Controller::Resource::Create - a create action for your resource |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 VERSION |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
version 0.03 |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 activate_fields_create |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
arrayref of form fields to activate in the create form |
|
53
|
|
|
|
|
|
|
Example: ['password', 'password_confirm'] |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Can be overriden with $c->stash->{activate_form_fields} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
(default = []). |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Example: You only want admins to be able to change a field. |
|
60
|
|
|
|
|
|
|
Disable field by default in HTML::FormHandler. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 ACTIONS |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 create |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
create a resource |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHOR |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
David Schmidt <davewood@cpan.org> |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This software is copyright (c) 2011 by David Schmidt. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
77
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |