| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Plack::App::Search; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
258473
|
use base qw(Plack::Component::Tags::HTML); |
|
|
3
|
|
|
|
|
10
|
|
|
|
3
|
|
|
|
|
2481
|
|
|
4
|
3
|
|
|
3
|
|
253994
|
use strict; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
88
|
|
|
5
|
3
|
|
|
3
|
|
19
|
use warnings; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
203
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
|
|
27
|
use Plack::Util::Accessor qw(generator image_height image_link image_radius |
|
8
|
|
|
|
|
|
|
search_method search_placeholder search_title search_url tags_after |
|
9
|
3
|
|
|
3
|
|
14
|
title); |
|
|
3
|
|
|
|
|
9
|
|
|
10
|
3
|
|
|
3
|
|
1987
|
use Tags::HTML::Container; |
|
|
3
|
|
|
|
|
59445
|
|
|
|
3
|
|
|
|
|
2173
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = 0.05; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _prepare_app { |
|
15
|
5
|
|
|
5
|
|
331659
|
my $self = shift; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Defaults which rewrite defaults in module which I am inheriting. |
|
18
|
5
|
100
|
|
|
|
26
|
if (! $self->generator) { |
|
19
|
2
|
|
|
|
|
28
|
$self->generator(__PACKAGE__.'; Version: '.$VERSION); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
5
|
100
|
|
|
|
41
|
if (! $self->title) { |
|
23
|
2
|
|
|
|
|
17
|
$self->title('Search page'); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Inherite defaults. |
|
27
|
5
|
|
|
|
|
42
|
$self->SUPER::_prepare_app; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Defaults from this module. |
|
30
|
5
|
100
|
|
|
|
1034
|
if (! $self->search_method) { |
|
31
|
4
|
|
|
|
|
24
|
$self->search_method('get'); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
5
|
100
|
|
|
|
34
|
if (! $self->search_url) { |
|
35
|
2
|
|
|
|
|
9
|
$self->search_url('https://env.skim.cz'); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
5
|
|
|
|
|
30
|
$self->{'_container'} = Tags::HTML::Container->new( |
|
39
|
|
|
|
|
|
|
'css' => $self->css, |
|
40
|
|
|
|
|
|
|
'css_inner' => 'search', |
|
41
|
|
|
|
|
|
|
'tags' => $self->tags, |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
5
|
|
|
|
|
2007
|
return; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _css { |
|
48
|
5
|
|
|
5
|
|
3736
|
my $self = shift; |
|
49
|
|
|
|
|
|
|
|
|
50
|
5
|
|
|
|
|
23
|
$self->{'_container'}->process_css; |
|
51
|
5
|
100
|
|
|
|
1314
|
if (defined $self->image_link) { |
|
52
|
1
|
50
|
|
|
|
9
|
$self->css->put( |
|
|
|
50
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
['s', '.search'], |
|
54
|
|
|
|
|
|
|
['d', 'display', 'flex'], |
|
55
|
|
|
|
|
|
|
['d', 'flex-direction', 'column'], |
|
56
|
|
|
|
|
|
|
['d', 'align-items', 'center'], |
|
57
|
|
|
|
|
|
|
['e'], |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
['s', '.search img'], |
|
60
|
|
|
|
|
|
|
['d', 'margin-bottom', '20px'], |
|
61
|
|
|
|
|
|
|
['d', 'margin-left', 'auto'], |
|
62
|
|
|
|
|
|
|
['d', 'margin-right', 'auto'], |
|
63
|
|
|
|
|
|
|
defined $self->image_radius ? ( |
|
64
|
|
|
|
|
|
|
['d', 'border-radius', $self->image_radius], |
|
65
|
|
|
|
|
|
|
) : (), |
|
66
|
|
|
|
|
|
|
defined $self->image_height ? ( |
|
67
|
|
|
|
|
|
|
['d', 'height', $self->image_height], |
|
68
|
|
|
|
|
|
|
) : (), |
|
69
|
|
|
|
|
|
|
['e'], |
|
70
|
|
|
|
|
|
|
); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
$self->css->put( |
|
73
|
5
|
100
|
|
|
|
450
|
['s', '.search form'], |
|
74
|
|
|
|
|
|
|
['d', 'display', 'flex'], |
|
75
|
|
|
|
|
|
|
['d', 'align-items', 'center'], |
|
76
|
|
|
|
|
|
|
['e'], |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
['s', '.search input[type="text"]'], |
|
79
|
|
|
|
|
|
|
['d', 'padding', '10px'], |
|
80
|
|
|
|
|
|
|
['d', 'border-radius', '4px'], |
|
81
|
|
|
|
|
|
|
['d', 'border', '1px solid #ccc'], |
|
82
|
|
|
|
|
|
|
['e'], |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
['s', '.search button'], |
|
85
|
|
|
|
|
|
|
['d', 'margin-left', '10px'], |
|
86
|
|
|
|
|
|
|
['d', 'padding', '10px 20px'], |
|
87
|
|
|
|
|
|
|
['d', 'border-radius', '4px'], |
|
88
|
|
|
|
|
|
|
['d', 'background-color', '#4CAF50'], |
|
89
|
|
|
|
|
|
|
['d', 'color', 'white'], |
|
90
|
|
|
|
|
|
|
['d', 'border', 'none'], |
|
91
|
|
|
|
|
|
|
['d', 'cursor', 'pointer'], |
|
92
|
|
|
|
|
|
|
! defined $self->search_title ? ( |
|
93
|
|
|
|
|
|
|
['d', 'display', 'none'], |
|
94
|
|
|
|
|
|
|
) : (), |
|
95
|
|
|
|
|
|
|
['e'], |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
['s', '.search button:hover'], |
|
98
|
|
|
|
|
|
|
['d', 'background-color', '#45a049'], |
|
99
|
|
|
|
|
|
|
['e'], |
|
100
|
|
|
|
|
|
|
); |
|
101
|
|
|
|
|
|
|
|
|
102
|
5
|
|
|
|
|
4122
|
return; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub _tags_middle { |
|
106
|
5
|
|
|
5
|
|
21476
|
my $self = shift; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
$self->{'_container'}->process( |
|
109
|
|
|
|
|
|
|
sub { |
|
110
|
|
|
|
|
|
|
$self->tags->put( |
|
111
|
|
|
|
|
|
|
$self->image_link ? ( |
|
112
|
|
|
|
|
|
|
['b', 'img'], |
|
113
|
|
|
|
|
|
|
['a', 'src', $self->image_link], |
|
114
|
|
|
|
|
|
|
['e', 'img'], |
|
115
|
|
|
|
|
|
|
) : (), |
|
116
|
|
|
|
|
|
|
['b', 'form'], |
|
117
|
|
|
|
|
|
|
['a', 'method', $self->search_method], |
|
118
|
|
|
|
|
|
|
['a', 'action', $self->search_url], |
|
119
|
|
|
|
|
|
|
['b', 'input'], |
|
120
|
|
|
|
|
|
|
['a', 'type', 'text'], |
|
121
|
|
|
|
|
|
|
['a', 'autofocus', 'autofocus'], |
|
122
|
|
|
|
|
|
|
defined $self->search_placeholder ? ( |
|
123
|
|
|
|
|
|
|
['a', 'placeholder', $self->search_placeholder], |
|
124
|
|
|
|
|
|
|
) : (), |
|
125
|
|
|
|
|
|
|
['a', 'name', 'search'], |
|
126
|
|
|
|
|
|
|
['e', 'input'], |
|
127
|
|
|
|
|
|
|
['b', 'button'], |
|
128
|
|
|
|
|
|
|
['a', 'type', 'submit'], |
|
129
|
|
|
|
|
|
|
defined $self->search_title ? ( |
|
130
|
|
|
|
|
|
|
['d', $self->search_title], |
|
131
|
|
|
|
|
|
|
) : (), |
|
132
|
|
|
|
|
|
|
['e', 'button'], |
|
133
|
|
|
|
|
|
|
['e', 'form'], |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
defined $self->tags_after ? ( |
|
136
|
5
|
100
|
|
5
|
|
3281
|
@{$self->tags_after}, |
|
|
0
|
50
|
|
|
|
0
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
) : (), |
|
138
|
|
|
|
|
|
|
); |
|
139
|
|
|
|
|
|
|
}, |
|
140
|
5
|
|
|
|
|
42
|
); |
|
141
|
|
|
|
|
|
|
|
|
142
|
5
|
|
|
|
|
14517
|
return; |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
1; |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
__END__ |