line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Shakan::Renderer::HTML; |
2
|
23
|
|
|
23
|
|
145
|
use strict; |
|
23
|
|
|
|
|
255
|
|
|
23
|
|
|
|
|
591
|
|
3
|
23
|
|
|
23
|
|
112
|
use warnings; |
|
23
|
|
|
|
|
53
|
|
|
23
|
|
|
|
|
563
|
|
4
|
23
|
|
|
23
|
|
108
|
use Mouse; |
|
23
|
|
|
|
|
46
|
|
|
23
|
|
|
|
|
247
|
|
5
|
23
|
|
|
23
|
|
19737
|
use HTML::Escape (); |
|
23
|
|
|
|
|
23784
|
|
|
23
|
|
|
|
|
3668
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'id_tmpl' => ( |
8
|
|
|
|
|
|
|
is => 'ro', |
9
|
|
|
|
|
|
|
isa => 'Str', |
10
|
|
|
|
|
|
|
default => 'id_%s', |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub render { |
14
|
12
|
|
|
12
|
0
|
34
|
my ($self, $form) = @_; |
15
|
|
|
|
|
|
|
|
16
|
12
|
|
|
|
|
22
|
my @res; |
17
|
12
|
|
|
|
|
49
|
for my $field ($form->fields) { |
18
|
14
|
100
|
|
|
|
76
|
unless ($field->id) { |
19
|
12
|
|
|
|
|
140
|
$field->id(sprintf($self->id_tmpl(), $field->{name})); |
20
|
|
|
|
|
|
|
} |
21
|
14
|
50
|
|
|
|
80
|
if ($field->label) { |
22
|
14
|
100
|
66
|
|
|
88
|
my $label_css = ($field->has_label_class() && $field->label_class ne '') |
23
|
|
|
|
|
|
|
? sprintf(q{ class="%s"}, $field->label_class) |
24
|
|
|
|
|
|
|
: ''; |
25
|
|
|
|
|
|
|
push @res, sprintf( q{<label%s for="%s">%s</label>}, |
26
|
14
|
|
|
|
|
123
|
$label_css, $field->{id}, HTML::Escape::escape_html( $field->{label} ) ); |
27
|
|
|
|
|
|
|
} |
28
|
14
|
|
|
|
|
79
|
push @res, $form->widgets->render( $form, $field ); |
29
|
|
|
|
|
|
|
} |
30
|
12
|
|
|
|
|
83
|
join '', @res; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
23
|
|
|
23
|
|
166
|
no Mouse; |
|
23
|
|
|
|
|
62
|
|
|
23
|
|
|
|
|
167
|
|
34
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
35
|
|
|
|
|
|
|
__END__ |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 DESCRIPTION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
simple HTML renderer for HTML::Shakan. |