| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SyForm::ViewField::LabelHTML; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
3
|
|
|
3
|
|
109
|
$SyForm::ViewField::LabelHTML::AUTHORITY = 'cpan:GETTY'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
$SyForm::ViewField::LabelHTML::VERSION = '0.103'; |
|
6
|
3
|
|
|
3
|
|
21
|
use Moo; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
20
|
|
|
7
|
3
|
|
|
3
|
|
1002
|
use List::MoreUtils qw( uniq ); |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
58
|
|
|
8
|
3
|
|
|
3
|
|
2199
|
use HTML::Declare ':all'; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
2119
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with qw( |
|
11
|
|
|
|
|
|
|
MooX::Traits |
|
12
|
|
|
|
|
|
|
SyForm::CommonRole::GlobalHTML |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has label => ( |
|
16
|
|
|
|
|
|
|
is => 'ro', |
|
17
|
|
|
|
|
|
|
required => 1, |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my @own_attributes = qw( for ); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
for my $attribute (@own_attributes, qw( errors )) { |
|
23
|
|
|
|
|
|
|
has $attribute => ( |
|
24
|
|
|
|
|
|
|
is => 'ro', |
|
25
|
|
|
|
|
|
|
predicate => 1, |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has html_declare => ( |
|
30
|
|
|
|
|
|
|
is => 'lazy', |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _build_html_declare { |
|
34
|
13
|
|
|
13
|
|
122
|
my ( $self ) = @_; |
|
35
|
13
|
|
|
|
|
20
|
my %html_attributes = %{$self->data_attributes}; |
|
|
13
|
|
|
|
|
195
|
|
|
36
|
13
|
|
|
|
|
28
|
for my $key (@SyForm::CommonRole::GlobalHTML::attributes) { |
|
37
|
208
|
|
|
|
|
301
|
my $has = 'has_'.$key; |
|
38
|
208
|
50
|
|
|
|
452
|
$html_attributes{$key} = $self->$key if $self->$has; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
13
|
|
|
|
|
59
|
for my $key (@own_attributes) { |
|
41
|
13
|
|
|
|
|
33
|
my $has = 'has_'.$key; |
|
42
|
13
|
50
|
|
|
|
58
|
$html_attributes{$key} = $self->$key if $self->$has; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
$html_attributes{_} = [ |
|
45
|
|
|
|
|
|
|
$self->label, |
|
46
|
|
|
|
|
|
|
$self->has_errors ? ( |
|
47
|
13
|
100
|
|
|
|
92
|
map { EM { _ => $_->message } } @{$self->errors} |
|
|
2
|
|
|
|
|
44
|
|
|
|
2
|
|
|
|
|
9
|
|
|
48
|
|
|
|
|
|
|
) : (), |
|
49
|
|
|
|
|
|
|
], |
|
50
|
|
|
|
|
|
|
return LABEL { %html_attributes }; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
SyForm::ViewField::LabelHTML |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 VERSION |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
version 0.103 |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudss.us> |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Torsten Raudssus. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
76
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |