line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::AquariumHive::Tile; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
32
|
$App::AquariumHive::Tile::AUTHORITY = 'cpan:GETTY'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: |
6
|
|
|
|
|
|
|
$App::AquariumHive::Tile::VERSION = '0.002'; |
7
|
1
|
|
|
1
|
|
3
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
239
|
use Carp qw( croak ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
9
|
1
|
|
|
1
|
|
512
|
use HTML::Entities; |
|
1
|
|
|
|
|
4240
|
|
|
1
|
|
|
|
|
416
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# leave white first! |
12
|
|
|
|
|
|
|
my @light_colors = qw( |
13
|
|
|
|
|
|
|
white |
14
|
|
|
|
|
|
|
lime |
15
|
|
|
|
|
|
|
green |
16
|
|
|
|
|
|
|
teal |
17
|
|
|
|
|
|
|
cyan |
18
|
|
|
|
|
|
|
cobalt |
19
|
|
|
|
|
|
|
indigo |
20
|
|
|
|
|
|
|
violet |
21
|
|
|
|
|
|
|
pink |
22
|
|
|
|
|
|
|
magenta |
23
|
|
|
|
|
|
|
red |
24
|
|
|
|
|
|
|
orange |
25
|
|
|
|
|
|
|
amber |
26
|
|
|
|
|
|
|
yellow |
27
|
|
|
|
|
|
|
lightBlue |
28
|
|
|
|
|
|
|
lightTeal |
29
|
|
|
|
|
|
|
lightOlive |
30
|
|
|
|
|
|
|
lightOrange |
31
|
|
|
|
|
|
|
lightPink |
32
|
|
|
|
|
|
|
lightRed |
33
|
|
|
|
|
|
|
lightGreen |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# leave black first! |
37
|
|
|
|
|
|
|
my @dark_colors = qw( |
38
|
|
|
|
|
|
|
black |
39
|
|
|
|
|
|
|
emerald |
40
|
|
|
|
|
|
|
crimson |
41
|
|
|
|
|
|
|
brown |
42
|
|
|
|
|
|
|
olive |
43
|
|
|
|
|
|
|
steel |
44
|
|
|
|
|
|
|
mauve |
45
|
|
|
|
|
|
|
taupe |
46
|
|
|
|
|
|
|
gray |
47
|
|
|
|
|
|
|
dark |
48
|
|
|
|
|
|
|
darker |
49
|
|
|
|
|
|
|
darkBrown |
50
|
|
|
|
|
|
|
darkCrimson |
51
|
|
|
|
|
|
|
darkMagenta |
52
|
|
|
|
|
|
|
darkIndigo |
53
|
|
|
|
|
|
|
darkCyan |
54
|
|
|
|
|
|
|
darkCobalt |
55
|
|
|
|
|
|
|
darkTeal |
56
|
|
|
|
|
|
|
darkEmerald |
57
|
|
|
|
|
|
|
darkGreen |
58
|
|
|
|
|
|
|
darkOrange |
59
|
|
|
|
|
|
|
darkRed |
60
|
|
|
|
|
|
|
darkPink |
61
|
|
|
|
|
|
|
darkViolet |
62
|
|
|
|
|
|
|
darkBlue |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $last_random = 0; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub random_bgcolor { |
68
|
0
|
|
|
0
|
0
|
|
$last_random++; |
69
|
0
|
0
|
|
|
|
|
$last_random = 1 if ($last_random > scalar @light_colors); |
70
|
0
|
|
|
|
|
|
return $light_colors[$last_random]; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# http://metroui.org.ua/global.html |
74
|
|
|
|
|
|
|
has bgcolor => ( |
75
|
|
|
|
|
|
|
is => 'lazy', |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
0
|
|
|
sub _build_bgcolor { random_bgcolor() } |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
has colspan => ( |
81
|
|
|
|
|
|
|
is => 'lazy', |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
0
|
|
|
sub _build_colspan { 1 } |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
has rowspan => ( |
87
|
|
|
|
|
|
|
is => 'lazy', |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
0
|
|
|
sub _build_rowspan { 1 } |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
has id => ( |
93
|
|
|
|
|
|
|
is => 'ro', |
94
|
|
|
|
|
|
|
predicate => 1, |
95
|
|
|
|
|
|
|
); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
has class => ( |
98
|
|
|
|
|
|
|
is => 'ro', |
99
|
|
|
|
|
|
|
predicate => 1, |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
has js => ( |
103
|
|
|
|
|
|
|
is => 'ro', |
104
|
|
|
|
|
|
|
predicate => 1, |
105
|
|
|
|
|
|
|
); |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
has content => ( |
108
|
|
|
|
|
|
|
is => 'ro', |
109
|
|
|
|
|
|
|
required => 1, |
110
|
|
|
|
|
|
|
); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
has html => ( |
113
|
|
|
|
|
|
|
is => 'lazy', |
114
|
|
|
|
|
|
|
); |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
0
|
|
|
sub _build_centered { 1 } |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub _build_html { |
119
|
0
|
|
|
0
|
|
|
my ( $self ) = @_; |
120
|
0
|
|
|
|
|
|
my %attr = $self->can('html_attributes') |
121
|
0
|
0
|
|
|
|
|
? (%{$self->html_attributes}) : (); |
122
|
0
|
0
|
|
|
|
|
$attr{'data-ss-colspan'} = $self->colspan unless $self->colspan == 1; |
123
|
0
|
0
|
|
|
|
|
$attr{'data-ss-rowspan'} = $self->rowspan unless $self->rowspan == 1; |
124
|
0
|
|
|
|
|
|
my @classes = qw( app-tile ); |
125
|
0
|
|
|
|
|
|
push @classes, 'bg-'.$self->bgcolor; |
126
|
0
|
0
|
|
|
|
|
push @classes, $self->class if $self->has_class; |
127
|
0
|
|
|
|
|
|
$attr{'class'} = join(' ',@classes); |
128
|
0
|
0
|
|
|
|
|
$attr{'id'} = $self->id if $self->has_id; |
129
|
0
|
|
|
|
|
|
return '<div '.join(' ',map { |
130
|
0
|
|
|
|
|
|
$_.'="'.encode_entities($attr{$_}).'"' |
131
|
|
|
|
|
|
|
} keys %attr).'>'.$self->content.'</div>'; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
1; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
__END__ |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=pod |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 NAME |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
App::AquariumHive::Tile - |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 VERSION |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
version 0.002 |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 AUTHOR |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudss.us> |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Torsten Raudssus. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
157
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |