line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormWidgets::List; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
788
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
3
|
use parent 'HTML::FormWidgets'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw( config data item_class ordered ) ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $NBSP = ' '; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init { |
12
|
2
|
|
|
2
|
1
|
4
|
my ($self, $args) = @_; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
8
|
$self->config ( {} ); |
15
|
2
|
|
|
|
|
30
|
$self->class ( 'plain' ); |
16
|
2
|
|
|
|
|
13
|
$self->data ( [] ); |
17
|
2
|
|
|
|
|
11
|
$self->item_class( undef ); |
18
|
2
|
|
|
|
|
11
|
$self->ordered ( 0 ); |
19
|
2
|
|
|
|
|
10
|
return; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub render_field { |
23
|
2
|
|
|
2
|
1
|
5
|
my ($self, $args) = @_; my $hacc = $self->hacc; my ($data, $html); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
6
|
|
24
|
|
|
|
|
|
|
|
25
|
2
|
50
|
33
|
|
|
6
|
($data = $self->data and $data->[ 0 ]) or return; my $js_args = {}; |
|
2
|
|
|
|
|
18
|
|
26
|
|
|
|
|
|
|
|
27
|
2
|
50
|
|
|
|
6
|
if ($self->id) { |
28
|
0
|
|
|
|
|
0
|
for (grep { defined $self->config->{ $_ } } keys %{ $self->config }) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
29
|
0
|
|
|
|
|
0
|
$js_args->{ $_ } = '"'.$self->config->{ $_ }.'"'; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
$self->add_literal_js( 'lists', $self->id, $js_args ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
2
|
50
|
|
|
|
12
|
my $item_args = $self->item_class ? { class => $self->item_class } : {} ; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
9
|
for my $item (@{ $data }) { |
|
2
|
|
|
|
|
4
|
|
38
|
4
|
|
33
|
|
|
74
|
$html .= $hacc->li( $item_args, |
39
|
|
|
|
|
|
|
$self->inflate( $item->{content} // $NBSP ) ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
2
|
50
|
|
|
|
64
|
$args = { class => $self->class }; $self->id and $args->{id} = $self->id; |
|
2
|
|
|
|
|
14
|
|
43
|
|
|
|
|
|
|
|
44
|
2
|
100
|
|
|
|
12
|
$self->ordered and return $hacc->ol( $args, $html ); |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
16
|
return $hacc->ul( $args, $html ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|