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