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