| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Yancy::Plugin::Form::Bootstrap4; |
|
2
|
|
|
|
|
|
|
our $VERSION = '1.087'; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: Generate forms using Bootstrap 4 |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
|
6
|
|
|
|
|
|
|
#pod |
|
7
|
|
|
|
|
|
|
#pod use Mojolicious::Lite; |
|
8
|
|
|
|
|
|
|
#pod plugin Yancy => { |
|
9
|
|
|
|
|
|
|
#pod backend => 'pg://localhost/mysite', |
|
10
|
|
|
|
|
|
|
#pod read_schema => 1, |
|
11
|
|
|
|
|
|
|
#pod }; |
|
12
|
|
|
|
|
|
|
#pod app->yancy->plugin( 'Form::Bootstrap4' ); |
|
13
|
|
|
|
|
|
|
#pod # See Yancy::Controller::Yancy for routing |
|
14
|
|
|
|
|
|
|
#pod app->routes->get( '/people/:id/edit' )->to( |
|
15
|
|
|
|
|
|
|
#pod 'yancy#set', |
|
16
|
|
|
|
|
|
|
#pod schema => 'people', |
|
17
|
|
|
|
|
|
|
#pod template => 'edit_people', |
|
18
|
|
|
|
|
|
|
#pod ); |
|
19
|
|
|
|
|
|
|
#pod app->start; |
|
20
|
|
|
|
|
|
|
#pod __DATA__ |
|
21
|
|
|
|
|
|
|
#pod @@ edit_people.html.ep |
|
22
|
|
|
|
|
|
|
#pod %= $c->yancy->form->form_for( 'people' ); |
|
23
|
|
|
|
|
|
|
#pod |
|
24
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
|
25
|
|
|
|
|
|
|
#pod |
|
26
|
|
|
|
|
|
|
#pod This plugin generates forms using the L
|
|
27
|
|
|
|
|
|
|
#pod 4.0|https://getbootstrap.com/docs/4.0/>. |
|
28
|
|
|
|
|
|
|
#pod |
|
29
|
|
|
|
|
|
|
#pod For details on the helpers added by this plugin, see |
|
30
|
|
|
|
|
|
|
#pod L. |
|
31
|
|
|
|
|
|
|
#pod |
|
32
|
|
|
|
|
|
|
#pod =head1 TEMPLATES |
|
33
|
|
|
|
|
|
|
#pod |
|
34
|
|
|
|
|
|
|
#pod To override these templates, add your own at the designated path inside |
|
35
|
|
|
|
|
|
|
#pod your app's C directory. |
|
36
|
|
|
|
|
|
|
#pod |
|
37
|
|
|
|
|
|
|
#pod =head2 yancy/form/bootstrap4/form.html.ep |
|
38
|
|
|
|
|
|
|
#pod |
|
39
|
|
|
|
|
|
|
#pod This template surrounds the form to create the C<< |
|
40
|
|
|
|
|
|
|
#pod list all the fields, and add a submit button. Also includes a CSRF token. |
|
41
|
|
|
|
|
|
|
#pod |
|
42
|
|
|
|
|
|
|
#pod =head2 yancy/form/bootstrap4/field.html.ep |
|
43
|
|
|
|
|
|
|
#pod |
|
44
|
|
|
|
|
|
|
#pod This template surrounds a single form field to add a C<< |
|
45
|
|
|
|
|
|
|
#pod element, the appropriate input element(s), and the optional description. |
|
46
|
|
|
|
|
|
|
#pod |
|
47
|
|
|
|
|
|
|
#pod =head2 yancy/form/bootstrap4/input.html.ep |
|
48
|
|
|
|
|
|
|
#pod |
|
49
|
|
|
|
|
|
|
#pod This template is for single C<< >> elements and the attributes |
|
50
|
|
|
|
|
|
|
#pod they need. This is used by field types C, C, C, |
|
51
|
|
|
|
|
|
|
#pod and string fields with formats C and C. |
|
52
|
|
|
|
|
|
|
#pod |
|
53
|
|
|
|
|
|
|
#pod =head2 yancy/form/bootstrap4/textarea.html.ep |
|
54
|
|
|
|
|
|
|
#pod |
|
55
|
|
|
|
|
|
|
#pod This template is for single C<< |
|
56
|
|
|
|
|
|
|
#pod attributes they need. This is used by fields with type C and |
|
57
|
|
|
|
|
|
|
#pod format C |
|
58
|
|
|
|
|
|
|
#pod |
|
59
|
|
|
|
|
|
|
#pod =head2 yancy/form/bootstrap4/select.html.ep |
|
60
|
|
|
|
|
|
|
#pod |
|
61
|
|
|
|
|
|
|
#pod This template is for single C<< |
|
62
|
|
|
|
|
|
|
#pod they need. This is used by fields with an C property. |
|
63
|
|
|
|
|
|
|
#pod |
|
64
|
|
|
|
|
|
|
#pod =head2 yancy/form/bootstrap4/yesno.html.ep |
|
65
|
|
|
|
|
|
|
#pod |
|
66
|
|
|
|
|
|
|
#pod This template displays a yes/no toggle used for fields of type |
|
67
|
|
|
|
|
|
|
#pod C. |
|
68
|
|
|
|
|
|
|
#pod |
|
69
|
|
|
|
|
|
|
#pod =head2 yancy/form/bootstrap4/readonly.html.ep |
|
70
|
|
|
|
|
|
|
#pod |
|
71
|
|
|
|
|
|
|
#pod This template displays all read-only fields. This template must not include |
|
72
|
|
|
|
|
|
|
#pod any kind of C<< >>, C<< |
|
73
|
|
|
|
|
|
|
#pod |
|
74
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
|
75
|
|
|
|
|
|
|
#pod |
|
76
|
|
|
|
|
|
|
#pod L, L |
|
77
|
|
|
|
|
|
|
#pod |
|
78
|
|
|
|
|
|
|
#pod =cut |
|
79
|
|
|
|
|
|
|
|
|
80
|
19
|
|
|
19
|
|
15497
|
use Mojo::Base 'Yancy::Plugin::Form'; |
|
|
19
|
|
|
|
|
61
|
|
|
|
19
|
|
|
|
|
134
|
|
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub register { |
|
83
|
52
|
|
|
52
|
1
|
536
|
my ( $self, $app, $conf ) = @_; |
|
84
|
52
|
|
|
|
|
407
|
$self->SUPER::register( $app, $conf ); |
|
85
|
52
|
|
|
|
|
62041
|
push @{$app->renderer->classes}, __PACKAGE__; |
|
|
52
|
|
|
|
|
265
|
|
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub input { |
|
89
|
90
|
|
|
90
|
0
|
511
|
my ( $self, $c, %opt ) = @_; |
|
90
|
|
|
|
|
|
|
|
|
91
|
90
|
100
|
|
|
|
281
|
die "input name is required" unless $opt{name}; |
|
92
|
89
|
|
66
|
|
|
415
|
$opt{value} //= $c->req->param( $opt{name} ); |
|
93
|
|
|
|
|
|
|
|
|
94
|
89
|
|
|
|
|
3879
|
my %attr; |
|
95
|
89
|
|
|
|
|
175
|
my $template = 'input'; |
|
96
|
|
|
|
|
|
|
my $type = !$opt{type} ? 'string' |
|
97
|
|
|
|
|
|
|
: ref $opt{type} eq 'ARRAY' ? $opt{type}[0] |
|
98
|
89
|
100
|
|
|
|
313
|
: $opt{type}; |
|
|
|
100
|
|
|
|
|
|
|
99
|
89
|
|
100
|
|
|
319
|
my $format = delete $opt{format} // ''; |
|
100
|
|
|
|
|
|
|
|
|
101
|
89
|
100
|
100
|
|
|
491
|
if ( $opt{ enum } ) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
102
|
8
|
|
|
|
|
20
|
$template = 'select'; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
elsif ( $type eq 'boolean' ) { |
|
105
|
2
|
|
|
|
|
5
|
$template = 'yesno'; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
elsif ( $type eq 'integer' || $type eq 'number' ) { |
|
108
|
12
|
|
|
|
|
25
|
$attr{ type } = 'number'; |
|
109
|
12
|
|
|
|
|
19
|
$attr{ inputmode } = 'decimal'; |
|
110
|
12
|
100
|
|
|
|
31
|
if ( $type eq 'integer' ) { |
|
111
|
|
|
|
|
|
|
# Enable numeric input mode on iOS with pattern attribute |
|
112
|
|
|
|
|
|
|
# https://css-tricks.com/finger-friendly-numerical-inputs-with-inputmode/ |
|
113
|
11
|
|
50
|
|
|
55
|
$opt{ pattern } ||= '[0-9]*'; |
|
114
|
11
|
|
|
|
|
22
|
$attr{ inputmode } = 'numeric'; |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
elsif ( $type eq 'string' ) { |
|
118
|
67
|
|
100
|
|
|
253
|
$attr{ type } = $format || 'text'; |
|
119
|
67
|
100
|
|
|
|
293
|
if ( $format eq 'textarea' ) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
120
|
4
|
|
|
|
|
8
|
$template = 'textarea'; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
elsif ( $format eq 'email' ) { |
|
123
|
14
|
|
100
|
|
|
45
|
$opt{ pattern } ||= '[^@]+@[^@]+'; |
|
124
|
14
|
|
|
|
|
35
|
$attr{ inputmode } = 'email'; |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
elsif ( $format eq 'date-time' ) { |
|
127
|
7
|
|
|
|
|
14
|
$attr{ type } = 'datetime-local'; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
elsif ( $format eq 'markdown' ) { |
|
130
|
1
|
|
|
|
|
4
|
$template = 'markdown'; |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
elsif ( $format eq 'password' ) { |
|
133
|
9
|
|
|
|
|
20
|
delete $opt{ value }; |
|
134
|
|
|
|
|
|
|
} |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
89
|
100
|
100
|
|
|
362
|
if ( my $readonly = ( delete $opt{ readOnly } or delete $opt{ readonly } ) ) { |
|
138
|
5
|
|
|
|
|
23
|
$template = 'readonly'; |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# ; use Data::Dumper; |
|
142
|
|
|
|
|
|
|
# ; say Dumper \%opt; |
|
143
|
|
|
|
|
|
|
# ; say Dumper \%attr; |
|
144
|
|
|
|
|
|
|
|
|
145
|
89
|
|
|
|
|
268
|
my $path = join '/', qw( yancy form bootstrap4 ), $template; |
|
146
|
89
|
|
|
|
|
706
|
my $html = $c->render_to_string( |
|
147
|
|
|
|
|
|
|
template => $path, |
|
148
|
|
|
|
|
|
|
input => { %opt, %attr }, |
|
149
|
|
|
|
|
|
|
); |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
# ; say $html; |
|
152
|
|
|
|
|
|
|
|
|
153
|
89
|
|
|
|
|
90110
|
return $html; |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub input_for { |
|
157
|
4
|
|
|
4
|
0
|
27
|
my ( $self, $c, $coll, $prop, %opt ) = @_; |
|
158
|
4
|
|
|
|
|
21
|
my $schema = $c->yancy->schema( $coll ); |
|
159
|
4
|
50
|
0
|
|
|
25
|
my $required = exists $opt{required} ? $opt{required} : !!grep { $_ eq $prop } @{ $schema->{required} // [] }; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
160
|
|
|
|
|
|
|
|
|
161
|
4
|
|
|
|
|
17
|
my $field = $schema->{properties}{ $prop }; |
|
162
|
|
|
|
|
|
|
my $input = $self->input( $c, |
|
163
|
|
|
|
|
|
|
%$field, |
|
164
|
|
|
|
|
|
|
( type => $opt{type} )x!!exists $opt{type}, |
|
165
|
|
|
|
|
|
|
( enum => $opt{enum} )x!!exists $opt{enum}, |
|
166
|
|
|
|
|
|
|
( format => $opt{format} )x!!exists $opt{format}, |
|
167
|
|
|
|
|
|
|
( enum_labels => $opt{ enum_labels } )x!!exists $opt{enum_labels}, |
|
168
|
|
|
|
|
|
|
name => $prop, |
|
169
|
|
|
|
|
|
|
value => $opt{value}, |
|
170
|
|
|
|
|
|
|
( $required ? ( required => $required ) : () ), |
|
171
|
4
|
50
|
|
|
|
240
|
( $opt{class} ? ( class => $opt{class} ) : () ), |
|
|
|
50
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
); |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub filter_for { |
|
176
|
4
|
|
|
4
|
0
|
19
|
my ( $self, $c, $coll, $prop, %opt ) = @_; |
|
177
|
4
|
|
|
|
|
18
|
my $schema = $c->yancy->schema( $coll ); |
|
178
|
4
|
|
|
|
|
17
|
my $field = $schema->{properties}{ $prop }; |
|
179
|
4
|
50
|
|
|
|
23
|
if ( $field->{type} eq 'boolean' ) { |
|
180
|
0
|
|
|
|
|
0
|
$opt{ type } = 'string'; |
|
181
|
0
|
|
|
|
|
0
|
$opt{ enum } = [ undef, 1, 0 ]; |
|
182
|
0
|
|
|
|
|
0
|
$opt{ enum_labels } = [ undef, 'Yes', 'No' ]; |
|
183
|
|
|
|
|
|
|
} |
|
184
|
4
|
|
|
|
|
16
|
$opt{format} = undef; |
|
185
|
4
|
|
66
|
|
|
45
|
$opt{ value } //= $c->req->param( $prop ); |
|
186
|
4
|
|
|
|
|
406
|
$opt{required} = 0; |
|
187
|
4
|
|
|
|
|
27
|
return $self->input_for( $c, $coll, $prop, %opt ); |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub field_for { |
|
191
|
68
|
|
|
68
|
0
|
196
|
my ( $self, $c, $coll, $prop, %opt ) = @_; |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
# ; use Data::Dumper; |
|
194
|
|
|
|
|
|
|
# ; say Dumper \%opt; |
|
195
|
68
|
|
|
|
|
396
|
my $schema = $c->yancy->schema( $coll ); |
|
196
|
68
|
|
50
|
|
|
133
|
my $required = !!grep { $_ eq $prop } @{ $schema->{required} // [] }; |
|
|
204
|
|
|
|
|
448
|
|
|
|
68
|
|
|
|
|
201
|
|
|
197
|
|
|
|
|
|
|
|
|
198
|
68
|
|
|
|
|
147
|
my $field = $schema->{properties}{ $prop }; |
|
199
|
|
|
|
|
|
|
my $input = $self->input( $c, |
|
200
|
|
|
|
|
|
|
%$field, |
|
201
|
|
|
|
|
|
|
name => $prop, |
|
202
|
|
|
|
|
|
|
value => $opt{value}, |
|
203
|
|
|
|
|
|
|
id => "field-$coll-$prop", |
|
204
|
|
|
|
|
|
|
( $required ? ( required => $required ) : () ), |
|
205
|
68
|
100
|
|
|
|
453
|
( $opt{class} ? ( class => $opt{class} ) : () ), |
|
|
|
100
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
); |
|
207
|
|
|
|
|
|
|
|
|
208
|
68
|
|
|
|
|
169
|
my $path = join '/', qw( yancy form bootstrap4 field ); |
|
209
|
68
|
|
|
|
|
693
|
my $html = $c->render_to_string( |
|
210
|
|
|
|
|
|
|
template => $path, |
|
211
|
|
|
|
|
|
|
field => { |
|
212
|
|
|
|
|
|
|
%$field, |
|
213
|
|
|
|
|
|
|
%opt, |
|
214
|
|
|
|
|
|
|
id => "field-$coll-$prop", |
|
215
|
|
|
|
|
|
|
name => $prop, |
|
216
|
|
|
|
|
|
|
required => $required, |
|
217
|
|
|
|
|
|
|
content => $input, |
|
218
|
|
|
|
|
|
|
}, |
|
219
|
|
|
|
|
|
|
); |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
# ; say $html; |
|
222
|
|
|
|
|
|
|
|
|
223
|
68
|
|
|
|
|
38043
|
return $html; |
|
224
|
|
|
|
|
|
|
} |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub form_for { |
|
227
|
8
|
|
|
8
|
0
|
33
|
my ( $self, $c, $coll, %opt ) = @_; |
|
228
|
|
|
|
|
|
|
|
|
229
|
8
|
|
100
|
|
|
45
|
my $item = $opt{ item } || $c->stash( 'item' ) || {}; |
|
230
|
8
|
|
|
|
|
100
|
my $props = $c->yancy->schema( $coll )->{properties}; |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
my $prop_names = $opt{properties} // $c->stash( 'properties' ) |
|
233
|
|
|
|
|
|
|
# By default, do not show read-only fields |
|
234
|
8
|
|
100
|
|
|
61
|
// [ grep !$props->{$_}{readOnly}, keys %$props ]; |
|
|
|
|
100
|
|
|
|
|
|
235
|
|
|
|
|
|
|
$props = { |
|
236
|
8
|
|
|
|
|
182
|
map { $_ => $props->{ $_ } } |
|
|
56
|
|
|
|
|
169
|
|
|
237
|
|
|
|
|
|
|
@$prop_names |
|
238
|
|
|
|
|
|
|
}; |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
my @sorted_props |
|
241
|
|
|
|
|
|
|
= sort { |
|
242
|
8
|
|
50
|
|
|
55
|
( $props->{$a}{'x-order'}//2**31 ) <=> ( $props->{$b}{'x-order'}//2**31 ) |
|
|
98
|
|
50
|
|
|
261
|
|
|
243
|
|
|
|
|
|
|
} |
|
244
|
|
|
|
|
|
|
keys %$props; |
|
245
|
8
|
|
|
|
|
18
|
my @fields; |
|
246
|
8
|
|
|
|
|
21
|
for my $field ( @sorted_props ) { |
|
247
|
|
|
|
|
|
|
my %field_opt = ( |
|
248
|
56
|
|
100
|
|
|
194
|
value => $c->req->param( $field ) // $item->{ $field }, |
|
249
|
|
|
|
|
|
|
); |
|
250
|
56
|
|
|
|
|
3031
|
push @fields, $self->field_for( $c, $coll, $field, %field_opt ); |
|
251
|
|
|
|
|
|
|
} |
|
252
|
|
|
|
|
|
|
|
|
253
|
8
|
100
|
66
|
|
|
38
|
if ( !exists $opt{csrf} || $opt{csrf} ) { |
|
254
|
|
|
|
|
|
|
# Verify that this form is being built with a real request |
|
255
|
|
|
|
|
|
|
# so the CSRF field can work correctly |
|
256
|
7
|
100
|
|
|
|
25
|
if ( !$c->tx->remote_address ) { |
|
257
|
1
|
|
|
|
|
31
|
$c->log->warn( 'form_for() called with incomplete request. CSRF token may not validate!'); |
|
258
|
|
|
|
|
|
|
} |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
|
|
261
|
8
|
|
|
|
|
498
|
my $path = join '/', qw( yancy form bootstrap4 form); |
|
262
|
8
|
|
|
|
|
55
|
my $html = $c->render_to_string( |
|
263
|
|
|
|
|
|
|
template => $path, |
|
264
|
|
|
|
|
|
|
form => { |
|
265
|
|
|
|
|
|
|
method => 'POST', |
|
266
|
|
|
|
|
|
|
csrf => 1, |
|
267
|
|
|
|
|
|
|
%opt, |
|
268
|
|
|
|
|
|
|
fields => \@fields, |
|
269
|
|
|
|
|
|
|
}, |
|
270
|
|
|
|
|
|
|
); |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
# ; say $html; |
|
273
|
|
|
|
|
|
|
|
|
274
|
8
|
|
|
|
|
9235
|
return $html; |
|
275
|
|
|
|
|
|
|
} |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=pod |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=head1 NAME |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
Yancy::Plugin::Form::Bootstrap4 - Generate forms using Bootstrap 4 |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=head1 VERSION |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
version 1.087 |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
use Mojolicious::Lite; |
|
290
|
|
|
|
|
|
|
plugin Yancy => { |
|
291
|
|
|
|
|
|
|
backend => 'pg://localhost/mysite', |
|
292
|
|
|
|
|
|
|
read_schema => 1, |
|
293
|
|
|
|
|
|
|
}; |
|
294
|
|
|
|
|
|
|
app->yancy->plugin( 'Form::Bootstrap4' ); |
|
295
|
|
|
|
|
|
|
# See Yancy::Controller::Yancy for routing |
|
296
|
|
|
|
|
|
|
app->routes->get( '/people/:id/edit' )->to( |
|
297
|
|
|
|
|
|
|
'yancy#set', |
|
298
|
|
|
|
|
|
|
schema => 'people', |
|
299
|
|
|
|
|
|
|
template => 'edit_people', |
|
300
|
|
|
|
|
|
|
); |
|
301
|
|
|
|
|
|
|
app->start; |
|
302
|
|
|
|
|
|
|
__DATA__ |
|
303
|
|
|
|
|
|
|
@@ edit_people.html.ep |
|
304
|
|
|
|
|
|
|
%= $c->yancy->form->form_for( 'people' ); |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
This plugin generates forms using the L
|
|
309
|
|
|
|
|
|
|
4.0|https://getbootstrap.com/docs/4.0/>. |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
For details on the helpers added by this plugin, see |
|
312
|
|
|
|
|
|
|
L. |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=head1 TEMPLATES |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
To override these templates, add your own at the designated path inside |
|
317
|
|
|
|
|
|
|
your app's C directory. |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=head2 yancy/form/bootstrap4/form.html.ep |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
This template surrounds the form to create the C<< |
|
322
|
|
|
|
|
|
|
list all the fields, and add a submit button. Also includes a CSRF token. |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=head2 yancy/form/bootstrap4/field.html.ep |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
This template surrounds a single form field to add a C<< |
|
327
|
|
|
|
|
|
|
element, the appropriate input element(s), and the optional description. |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=head2 yancy/form/bootstrap4/input.html.ep |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
This template is for single C<< >> elements and the attributes |
|
332
|
|
|
|
|
|
|
they need. This is used by field types C, C, C, |
|
333
|
|
|
|
|
|
|
and string fields with formats C and C. |
|
334
|
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=head2 yancy/form/bootstrap4/textarea.html.ep |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
This template is for single C<< |
|
338
|
|
|
|
|
|
|
attributes they need. This is used by fields with type C and |
|
339
|
|
|
|
|
|
|
format C |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=head2 yancy/form/bootstrap4/select.html.ep |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
This template is for single C<< |
|
344
|
|
|
|
|
|
|
they need. This is used by fields with an C property. |
|
345
|
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
=head2 yancy/form/bootstrap4/yesno.html.ep |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
This template displays a yes/no toggle used for fields of type |
|
349
|
|
|
|
|
|
|
C. |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=head2 yancy/form/bootstrap4/readonly.html.ep |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
This template displays all read-only fields. This template must not include |
|
354
|
|
|
|
|
|
|
any kind of C<< >>, C<< |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
L, L |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
=head1 AUTHOR |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
Doug Bell |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Doug Bell. |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
369
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=cut |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
__DATA__ |