line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormWidgets::Checkbox; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1198
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
63
|
|
4
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
5
|
1
|
|
|
1
|
|
8
|
use parent 'HTML::FormWidgets'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw( checked label_class labels value ) ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
1
|
|
|
1
|
1
|
3
|
my ($self, $args) = @_; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
5
|
$self->checked ( 0 ); |
13
|
1
|
|
|
|
|
8
|
$self->label_class( 'checkbox_label' ); |
14
|
1
|
|
|
|
|
8
|
$self->labels ( {} ); |
15
|
1
|
|
|
|
|
7
|
$self->value ( 1 ); |
16
|
1
|
|
|
|
|
5
|
return; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub render_field { |
20
|
1
|
|
|
1
|
1
|
3
|
my ($self, $args) = @_; my $hacc = $self->hacc; |
|
1
|
|
|
|
|
4
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
0
|
|
|
|
7
|
$self->checked and $args->{checked} = $self->is_xml ? 'checked' : undef; |
|
|
50
|
|
|
|
|
|
23
|
1
|
|
|
|
|
7
|
$args->{value} = $self->value; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
23
|
my $html = $hacc->checkbox( $args ); |
26
|
|
|
|
|
|
|
|
27
|
1
|
50
|
|
|
|
88
|
my $label; exists $self->labels->{ $self->value } |
|
1
|
|
|
|
|
5
|
|
28
|
|
|
|
|
|
|
and $label = $self->labels->{ $self->value }; |
29
|
|
|
|
|
|
|
|
30
|
1
|
50
|
|
|
|
13
|
$label and $html .= $hacc->span( { class => $self->label_class }, $label ); |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
9
|
return $hacc->div( { class => 'checkbox_container' }, $html ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|