line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormWidgets::List; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1911
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
4
|
use parent 'HTML::FormWidgets'; |
|
1
|
|
|
|
|
2
|
|
|
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
|
3
|
my ($self, $args) = @_; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
6
|
$self->config ( {} ); |
15
|
2
|
|
|
|
|
16
|
$self->class ( 'plain' ); |
16
|
2
|
|
|
|
|
14
|
$self->data ( [] ); |
17
|
2
|
|
|
|
|
12
|
$self->item_class( undef ); |
18
|
2
|
|
|
|
|
10
|
$self->ordered ( 0 ); |
19
|
2
|
|
|
|
|
10
|
return; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub render_field { |
23
|
2
|
|
|
2
|
1
|
4
|
my ($self, $args) = @_; my $hacc = $self->hacc; my ($data, $html); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
7
|
|
24
|
|
|
|
|
|
|
|
25
|
2
|
50
|
33
|
|
|
5
|
($data = $self->data and $data->[ 0 ]) or return; my $js_args = {}; |
|
2
|
|
|
|
|
14
|
|
26
|
|
|
|
|
|
|
|
27
|
2
|
50
|
|
|
|
5
|
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
|
|
|
|
|
3
|
|
38
|
|
|
|
|
|
|
$html .= $hacc->li( $item_args, |
39
|
4
|
|
33
|
|
|
69
|
$self->inflate( $item->{content} // $NBSP ) ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
2
|
50
|
|
|
|
60
|
$args = { class => $self->class }; $self->id and $args->{id} = $self->id; |
|
2
|
|
|
|
|
15
|
|
43
|
|
|
|
|
|
|
|
44
|
2
|
100
|
|
|
|
13
|
$self->ordered and return $hacc->ol( $args, $html ); |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
13
|
return $hacc->ul( $args, $html ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|