line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Yancy::Plugin::Form; |
2
|
|
|
|
|
|
|
our $VERSION = '1.086'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Generate form HTML using various UI libraries |
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 app->routes->get( '/people/:id/edit' )->to( |
14
|
|
|
|
|
|
|
#pod 'yancy#set', |
15
|
|
|
|
|
|
|
#pod schema => 'people', |
16
|
|
|
|
|
|
|
#pod template => 'edit_people', |
17
|
|
|
|
|
|
|
#pod ); |
18
|
|
|
|
|
|
|
#pod app->start; |
19
|
|
|
|
|
|
|
#pod __DATA__ |
20
|
|
|
|
|
|
|
#pod @@ edit_people.html.ep |
21
|
|
|
|
|
|
|
#pod %= $c->yancy->form->form_for( 'people' ); |
22
|
|
|
|
|
|
|
#pod |
23
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
24
|
|
|
|
|
|
|
#pod |
25
|
|
|
|
|
|
|
#pod The Form plugins generate forms from JSON schemas. Plugin and |
26
|
|
|
|
|
|
|
#pod application developers can use the form plugin API to make forms, and |
27
|
|
|
|
|
|
|
#pod then sites can load a specific form library plugin to match the style of |
28
|
|
|
|
|
|
|
#pod the site. |
29
|
|
|
|
|
|
|
#pod |
30
|
|
|
|
|
|
|
#pod B This API is B and will be considered stable in |
31
|
|
|
|
|
|
|
#pod Yancy version 2.0. Please report any issues you have or features you'd |
32
|
|
|
|
|
|
|
#pod like to see. Minor things may change before version 2.0, so be sure to |
33
|
|
|
|
|
|
|
#pod read the release changelog before upgrading. |
34
|
|
|
|
|
|
|
#pod |
35
|
|
|
|
|
|
|
#pod =head2 Available Libraries |
36
|
|
|
|
|
|
|
#pod |
37
|
|
|
|
|
|
|
#pod =over |
38
|
|
|
|
|
|
|
#pod |
39
|
|
|
|
|
|
|
#pod =item * L - Forms using L |
40
|
|
|
|
|
|
|
#pod |
41
|
|
|
|
|
|
|
#pod =back |
42
|
|
|
|
|
|
|
#pod |
43
|
|
|
|
|
|
|
#pod =head1 HELPERS |
44
|
|
|
|
|
|
|
#pod |
45
|
|
|
|
|
|
|
#pod All form plugins add the same helpers with the same arguments so that |
46
|
|
|
|
|
|
|
#pod applications can use the form plugin that matches their site's |
47
|
|
|
|
|
|
|
#pod appearance. Yancy plugin and app developers should use form plugins to |
48
|
|
|
|
|
|
|
#pod build forms so that users can easily customize the form's appearance. |
49
|
|
|
|
|
|
|
#pod |
50
|
|
|
|
|
|
|
#pod =head2 yancy->form->input |
51
|
|
|
|
|
|
|
#pod |
52
|
|
|
|
|
|
|
#pod my $html = $c->yancy->form->input( %args ); |
53
|
|
|
|
|
|
|
#pod %= $c->yancy->form->plugin( %args ); |
54
|
|
|
|
|
|
|
#pod |
55
|
|
|
|
|
|
|
#pod Create a form input. Usually one of a C<< >>, C<< |