line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormHandler::Widget::Form::Table; |
2
|
|
|
|
|
|
|
# ABSTRACT: render a form with a table layout |
3
|
|
|
|
|
|
|
$HTML::FormHandler::Widget::Form::Table::VERSION = '0.40067'; |
4
|
2
|
|
|
2
|
|
1554
|
use Moose::Role; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
18
|
|
5
|
|
|
|
|
|
|
with 'HTML::FormHandler::Widget::Form::Simple' => |
6
|
|
|
|
|
|
|
{ -excludes => [ 'render_start', 'render_end', 'render_form_errors' ] }; |
7
|
2
|
|
|
2
|
|
7546
|
use HTML::FormHandler::Render::Util ('process_attrs'); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
16
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub render_start { |
11
|
4
|
|
|
4
|
0
|
9
|
my ( $self, $result ) = @_; |
12
|
4
|
|
33
|
|
|
12
|
$result ||= $self->result; |
13
|
4
|
|
|
|
|
24
|
my $fattrs = process_attrs($self->attributes($result)); |
14
|
4
|
|
|
|
|
30
|
my $wattrs = process_attrs($self->form_wrapper_attributes($result)); |
15
|
4
|
|
|
|
|
24
|
return qq{<form$fattrs><table$wattrs>\n}; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub render_form_errors { |
19
|
0
|
|
|
0
|
0
|
0
|
my ( $self, $result ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
0
|
return '' unless $result->has_form_errors; |
22
|
0
|
|
|
|
|
0
|
my $output = "\n<tr class=\"form_errors\"><td colspan=\"2\">"; |
23
|
|
|
|
|
|
|
$output .= qq{\n<span class="error_message">$_</span>} |
24
|
0
|
|
|
|
|
0
|
for $result->all_form_errors; |
25
|
0
|
|
|
|
|
0
|
$output .= "\n</td></tr>"; |
26
|
0
|
|
|
|
|
0
|
return $output; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub render_end { |
30
|
4
|
|
|
4
|
0
|
8
|
my $self = shift; |
31
|
4
|
|
|
|
|
11
|
my $output .= "</table>\n"; |
32
|
4
|
|
|
|
|
6
|
$output .= "</form>\n"; |
33
|
4
|
|
|
|
|
17
|
return $output; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
2
|
|
655
|
use namespace::autoclean; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
19
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=pod |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=encoding UTF-8 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
HTML::FormHandler::Widget::Form::Table - render a form with a table layout |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 VERSION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
version 0.40067 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SYNOPSIS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Set in your form: |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has '+widget_form' => ( default => 'Table' ); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Use in a template: |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
[% form.render %] |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
FormHandler Contributors - see HTML::FormHandler |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Gerda Shank. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
72
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |