| 1 | package Tags::HTML::Pager; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use base qw(Tags::HTML); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use Class::Utils qw(set_params split_params); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use Error::Pure qw(err); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use Readonly; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use Unicode::UTF8 qw(decode_utf8); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 5 | Readonly::Scalar our $NUMBER_OF_BOXES => 7; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 5 | our $VERSION = 0.02; | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # Constructor. | ||||||||||||||||||||||||||||||||||||||||||
| 17 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | my ($class, @params) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | # Create object. | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | my ($object_params_ar, $other_params_ar) = split_params( | |||||||||||||||||||||||||||||||||||||||||
| 22 | ['css_colors', 'css_pager', 'flag_prev_next', 'flag_paginator', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 'url_page_cb'], @params); | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 3 | my $self = $class->SUPER::new(@{$other_params_ar}); | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | # CSS colors. | ||||||||||||||||||||||||||||||||||||||||||
| 27 | $self->{'css_colors'} = { | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 'actual_background' => 'black', | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 'actual_color' => 'white', | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 'border' => 'black', | ||||||||||||||||||||||||||||||||||||||||||
| 31 | 'hover_background' => 'black', | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 'hover_color' => 'white', | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 'other_background' => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 'other_color' => 'black', | ||||||||||||||||||||||||||||||||||||||||||
| 35 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | # CSS class. | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $self->{'css_pager'} = 'pager'; | |||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | # Flag for prev/next buttons. | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $self->{'flag_prev_next'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | # Flag for paginator. | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | $self->{'flag_paginator'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | # URL of page. | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | $self->{'url_page_cb'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | # Process params. | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | set_params($self, @{$object_params_ar}); | |||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | if (! defined $self->{'css_pager'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | err "Parameter 'css_pager' is required."; | |||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if (! defined $self->{'url_page_cb'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | err "Missing 'url_page_cb' parameter."; | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if (! $self->{'flag_paginator'} && ! $self->{'flag_prev_next'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"flag_paginator"} or $self->{"flag_prev_next"}
MC/DC0%0/2
$self->{"flag_paginator"} or $self->{"flag_prev_next"}
$self->{"flag_paginator"}
$self->{"flag_prev_next"}
Truth table0%0/3
A or B
A= $self->{"flag_paginator"}B= $self->{"flag_prev_next"}
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | err 'Both paginator styles disabled.'; | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | # Object. | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | sub _process { | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | my ($self, $pages_hr) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process: not called CC=26 SCAR=65.5
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | if (! $pages_hr) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | err 'Pages data structure is missing.'; | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | if (! exists $pages_hr->{'pages_num'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | err "Missing 'pages_num' parameter in pages data structure."; | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if (! exists $pages_hr->{'actual_page'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | err "Missing 'actual_page' parameter in pages data structure."; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if ($pages_hr->{'actual_page'} > $pages_hr->{'pages_num'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | err "Parameter 'actual_page' is greater than parameter 'pages_num'.", | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 'actual_page', $pages_hr->{'actual_page'}, | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | 'pages_num', $pages_hr->{'pages_num'}, | |||||||||||||||||||||||||||||||||||||||||
| 84 | ; | ||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | # No code. | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | if (! $self->{'flag_paginator'} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $self->{"flag_paginator"} and $self->{"flag_prev_next"} and $pages_hr->{"pages_num"} == 1
not $self->{"flag_paginator"} and $self->{"flag_prev_next"}
MC/DC0%0/3
not $self->{"flag_paginator"} and $self->{"flag_prev_next"} and $pages_hr->{"pages_num"} == 1
not $self->{"flag_paginator"}
$self->{"flag_prev_next"}
$pages_hr->{"pages_num"} == 1
Truth table0%0/4
not(A) and B and C
A= not $self->{"flag_paginator"}B= $self->{"flag_prev_next"}C= $pages_hr->{"pages_num"} == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | && $self->{'flag_prev_next'} && $pages_hr->{'pages_num'} == 1) { | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | $self->{'tags'}->put( | ||||||||||||||||||||||||||||||||||||||||||
| 95 | ['b', 'div'], | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ['a', 'class', $self->{'css_pager'}], | |||||||||||||||||||||||||||||||||||||||||
| 97 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | # Paginator | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if ($self->{'flag_paginator'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $self->{'tags'}->put( | |||||||||||||||||||||||||||||||||||||||||
| 102 | ['b', 'p'], | ||||||||||||||||||||||||||||||||||||||||||
| 103 | ['a', 'class', $self->_css_class('paginator')], | ||||||||||||||||||||||||||||||||||||||||||
| 104 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my $buttons_from = 1; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my $buttons_to = $pages_hr->{'pages_num'}; | |||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if ($pages_hr->{'actual_page'} > 4 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pages_hr->{"actual_page"} > 4 and $pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
MC/DC0%0/2
$pages_hr->{"actual_page"} > 4 and $pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
$pages_hr->{"actual_page"} > 4
$pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
Truth table0%0/3
A and B
A= $pages_hr->{"actual_page"} > 4B= $pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | && $pages_hr->{'pages_num'} > $NUMBER_OF_BOXES) { | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | $self->{'tags'}->put( | ||||||||||||||||||||||||||||||||||||||||||
| 111 | ['b', 'a'], | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ['a', 'href', $self->{'url_page_cb'}->(1)], | |||||||||||||||||||||||||||||||||||||||||
| 113 | ['d', 1], | ||||||||||||||||||||||||||||||||||||||||||
| 114 | ['e', 'a'], | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | ['b', 'span'], | ||||||||||||||||||||||||||||||||||||||||||
| 117 | ['d', decode_utf8('…')], | ||||||||||||||||||||||||||||||||||||||||||
| 118 | ['e', 'span'], | ||||||||||||||||||||||||||||||||||||||||||
| 119 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | if ($pages_hr->{'actual_page'} < $pages_hr->{'pages_num'} - 3) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $buttons_from = $pages_hr->{'actual_page'} - 1; | |||||||||||||||||||||||||||||||||||||||||
| 122 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $buttons_from = $pages_hr->{'pages_num'} - 4; | |||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | if ($pages_hr->{'actual_page'} < $pages_hr->{'pages_num'} - 3 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pages_hr->{"actual_page"} < $pages_hr->{"pages_num"} - 3 and $pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
MC/DC0%0/2
$pages_hr->{"actual_page"} < $pages_hr->{"pages_num"} - 3 and $pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
$pages_hr->{"actual_page"} < $pages_hr->{"pages_num"} - 3
$pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
Truth table0%0/3
A and B
A= $pages_hr->{"actual_page"} < $pages_hr->{"pages_num"} - 3B= $pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | && $pages_hr->{'pages_num'} > $NUMBER_OF_BOXES) { | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | if ($pages_hr->{'actual_page'} > 4) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $buttons_to = $pages_hr->{'actual_page'} + 1; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $buttons_to = 5; | |||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | foreach my $button_num ($buttons_from .. $buttons_to) { | |||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | if ($pages_hr->{'actual_page'} eq $button_num) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $self->{'tags'}->put( | |||||||||||||||||||||||||||||||||||||||||
| 138 | ['b', 'strong'], | ||||||||||||||||||||||||||||||||||||||||||
| 139 | ['a', 'class', $self->_css_class('paginator-selected')], | ||||||||||||||||||||||||||||||||||||||||||
| 140 | ['d', $button_num], | ||||||||||||||||||||||||||||||||||||||||||
| 141 | ['e', 'strong'], | ||||||||||||||||||||||||||||||||||||||||||
| 142 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 143 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 144 | $self->{'tags'}->put( | ||||||||||||||||||||||||||||||||||||||||||
| 145 | ['b', 'a'], | ||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ['a', 'href', $self->{'url_page_cb'}->($button_num)], | |||||||||||||||||||||||||||||||||||||||||
| 147 | ['d', $button_num], | ||||||||||||||||||||||||||||||||||||||||||
| 148 | ['e', 'a'], | ||||||||||||||||||||||||||||||||||||||||||
| 149 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | if ($pages_hr->{'actual_page'} < $pages_hr->{'pages_num'} - 3 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pages_hr->{"actual_page"} < $pages_hr->{"pages_num"} - 3 and $pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
MC/DC0%0/2
$pages_hr->{"actual_page"} < $pages_hr->{"pages_num"} - 3 and $pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
$pages_hr->{"actual_page"} < $pages_hr->{"pages_num"} - 3
$pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
Truth table0%0/3
A and B
A= $pages_hr->{"actual_page"} < $pages_hr->{"pages_num"} - 3B= $pages_hr->{"pages_num"} > $Tags::HTML::Pager::NUMBER_OF_BOXES
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | && $pages_hr->{'pages_num'} > $NUMBER_OF_BOXES) { | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | $self->{'tags'}->put( | ||||||||||||||||||||||||||||||||||||||||||
| 156 | ['b', 'span'], | ||||||||||||||||||||||||||||||||||||||||||
| 157 | ['d', decode_utf8('…')], | ||||||||||||||||||||||||||||||||||||||||||
| 158 | ['e', 'span'], | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | ['b', 'a'], | ||||||||||||||||||||||||||||||||||||||||||
| 161 | ['a', 'href', $self->{'url_page_cb'}->($pages_hr->{'pages_num'})], | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ['d', $pages_hr->{'pages_num'}], | |||||||||||||||||||||||||||||||||||||||||
| 163 | ['e', 'a'], | ||||||||||||||||||||||||||||||||||||||||||
| 164 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $self->{'tags'}->put( | |||||||||||||||||||||||||||||||||||||||||
| 167 | ['e', 'p'], | ||||||||||||||||||||||||||||||||||||||||||
| 168 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | # Paging. | ||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if ($self->{'flag_prev_next'} && $pages_hr->{'pages_num'} > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"flag_prev_next"} and $pages_hr->{"pages_num"} > 1
MC/DC0%0/2
$self->{"flag_prev_next"} and $pages_hr->{"pages_num"} > 1
$self->{"flag_prev_next"}
$pages_hr->{"pages_num"} > 1
Truth table0%0/3
A and B
A= $self->{"flag_prev_next"}B= $pages_hr->{"pages_num"} > 1
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | my ($prev, $next); | |||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | if ($pages_hr->{'pages_num'} > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ($pages_hr->{'actual_page'} > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $prev = $pages_hr->{'actual_page'} - 1; | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | if ($pages_hr->{'actual_page'} < $pages_hr->{'pages_num'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $next = $pages_hr->{'actual_page'} + 1; | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | $self->{'tags'}->put( | ||||||||||||||||||||||||||||||||||||||||||
| 184 | ['b', 'p'], | ||||||||||||||||||||||||||||||||||||||||||
| 185 | ['a', 'class', $self->_css_class('prev_next')], | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | # Previous page. | ||||||||||||||||||||||||||||||||||||||||||
| 188 | $prev ? ( | ||||||||||||||||||||||||||||||||||||||||||
| 189 | ['b', 'a'], | ||||||||||||||||||||||||||||||||||||||||||
| 190 | ['a', 'class', $self->_css_class('prev')], | ||||||||||||||||||||||||||||||||||||||||||
| 191 | ['a', 'href', $self->{'url_page_cb'}->($prev)], | ||||||||||||||||||||||||||||||||||||||||||
| 192 | ['d', decode_utf8('←')], | ||||||||||||||||||||||||||||||||||||||||||
| 193 | ['e', 'a'], | ||||||||||||||||||||||||||||||||||||||||||
| 194 | ) : ( | ||||||||||||||||||||||||||||||||||||||||||
| 195 | ['b', 'span'], | ||||||||||||||||||||||||||||||||||||||||||
| 196 | ['a', 'class', $self->_css_class('prev-disabled')], | ||||||||||||||||||||||||||||||||||||||||||
| 197 | ['d', decode_utf8('←')], | ||||||||||||||||||||||||||||||||||||||||||
| 198 | ['e', 'span'], | ||||||||||||||||||||||||||||||||||||||||||
| 199 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | # Next page. | ||||||||||||||||||||||||||||||||||||||||||
| 202 | $next ? ( | ||||||||||||||||||||||||||||||||||||||||||
| 203 | ['b', 'a'], | ||||||||||||||||||||||||||||||||||||||||||
| 204 | ['a', 'class', $self->_css_class('next')], | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | ['a', 'href', $self->{'url_page_cb'}->($next)], | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | ['d', decode_utf8('→')], | ||||||||||||||||||||||||||||||||||||||||||
| 207 | ['e', 'a'], | ||||||||||||||||||||||||||||||||||||||||||
| 208 | ) : ( | ||||||||||||||||||||||||||||||||||||||||||
| 209 | ['b', 'span'], | ||||||||||||||||||||||||||||||||||||||||||
| 210 | ['a', 'class', $self->_css_class('next-disabled')], | ||||||||||||||||||||||||||||||||||||||||||
| 211 | ['d', decode_utf8('→')], | ||||||||||||||||||||||||||||||||||||||||||
| 212 | ['e', 'span'], | ||||||||||||||||||||||||||||||||||||||||||
| 213 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | ['e', 'p'], | ||||||||||||||||||||||||||||||||||||||||||
| 216 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $self->{'tags'}->put( | |||||||||||||||||||||||||||||||||||||||||
| 220 | ['e', 'div'], | ||||||||||||||||||||||||||||||||||||||||||
| 221 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | sub _process_css { | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_css: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | $self->{'css'}->put( | ||||||||||||||||||||||||||||||||||||||||||
| 230 | ['s', '.'.$self->{'css_pager'}.' a'], | ||||||||||||||||||||||||||||||||||||||||||
| 231 | ['d', 'text-decoration', 'none'], | ||||||||||||||||||||||||||||||||||||||||||
| 232 | ['e'], | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | ['s', '.'.$self->_css_class('paginator')], | ||||||||||||||||||||||||||||||||||||||||||
| 235 | ['d', 'display', 'flex'], | ||||||||||||||||||||||||||||||||||||||||||
| 236 | ['d', 'flex-wrap', 'wrap'], | ||||||||||||||||||||||||||||||||||||||||||
| 237 | ['d', 'justify-content', 'center'], | ||||||||||||||||||||||||||||||||||||||||||
| 238 | ['d', 'padding-left', '130px'], | ||||||||||||||||||||||||||||||||||||||||||
| 239 | ['d', 'padding-right', '130px'], | ||||||||||||||||||||||||||||||||||||||||||
| 240 | ['d', 'float', 'both'], | ||||||||||||||||||||||||||||||||||||||||||
| 241 | ['e'], | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | ['s', '.'.$self->_css_class('prev_next')], | ||||||||||||||||||||||||||||||||||||||||||
| 244 | ['d', 'display', 'flex'], | ||||||||||||||||||||||||||||||||||||||||||
| 245 | ['e'], | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | ['s', '.'.$self->_css_class('paginator').' a'], | ||||||||||||||||||||||||||||||||||||||||||
| 248 | ['s', '.'.$self->_css_class('paginator').' strong'], | ||||||||||||||||||||||||||||||||||||||||||
| 249 | ['s', '.'.$self->_css_class('paginator').' span'], | ||||||||||||||||||||||||||||||||||||||||||
| 250 | ['s', '.'.$self->_css_class('next')], | ||||||||||||||||||||||||||||||||||||||||||
| 251 | ['s', '.'.$self->_css_class('next-disabled')], | ||||||||||||||||||||||||||||||||||||||||||
| 252 | ['s', '.'.$self->_css_class('prev')], | ||||||||||||||||||||||||||||||||||||||||||
| 253 | ['s', '.'.$self->_css_class('prev-disabled')], | ||||||||||||||||||||||||||||||||||||||||||
| 254 | ['d', 'display', 'flex'], | ||||||||||||||||||||||||||||||||||||||||||
| 255 | ['d', 'height', '55px'], | ||||||||||||||||||||||||||||||||||||||||||
| 256 | ['d', 'width', '55px'], | ||||||||||||||||||||||||||||||||||||||||||
| 257 | ['d', 'justify-content', 'center'], | ||||||||||||||||||||||||||||||||||||||||||
| 258 | ['d', 'align-items', 'center'], | ||||||||||||||||||||||||||||||||||||||||||
| 259 | ['d', 'border', '1px solid '.$self->{'css_colors'}->{'border'}], | ||||||||||||||||||||||||||||||||||||||||||
| 260 | ['d', 'margin-left', '-1px'], | ||||||||||||||||||||||||||||||||||||||||||
| 261 | ['e'], | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | ['s', '.'.$self->_css_class('prev')], | ||||||||||||||||||||||||||||||||||||||||||
| 265 | ['s', '.'.$self->_css_class('next')], | ||||||||||||||||||||||||||||||||||||||||||
| 266 | ['d', 'display', 'inline-flex'], | ||||||||||||||||||||||||||||||||||||||||||
| 267 | ['d', 'align-items', 'center'], | ||||||||||||||||||||||||||||||||||||||||||
| 268 | ['d', 'justify-content', 'center'], | ||||||||||||||||||||||||||||||||||||||||||
| 269 | ['e'], | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | ['s', '.'.$self->_css_class('paginator').' a:hover'], | ||||||||||||||||||||||||||||||||||||||||||
| 272 | ['s', '.'.$self->_css_class('prev_next').' a:hover'], | ||||||||||||||||||||||||||||||||||||||||||
| 273 | $self->_css_colors_optional('hover_color', 'color'), | ||||||||||||||||||||||||||||||||||||||||||
| 274 | $self->_css_colors_optional('hover_background', 'background-color'), | ||||||||||||||||||||||||||||||||||||||||||
| 275 | ['e'], | ||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | ['s', '.'.$self->_css_class('paginator').' a'], | ||||||||||||||||||||||||||||||||||||||||||
| 278 | $self->_css_colors_optional('other_color', 'color'), | ||||||||||||||||||||||||||||||||||||||||||
| 279 | $self->_css_colors_optional('other_background', 'background-color'), | ||||||||||||||||||||||||||||||||||||||||||
| 280 | ['e'], | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | ['s', '.'.$self->_css_class('paginator-selected')], | ||||||||||||||||||||||||||||||||||||||||||
| 283 | ['d', 'background-color', $self->{'css_colors'}->{'actual_background'}], | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ['d', 'color', $self->{'css_colors'}->{'actual_color'}], | |||||||||||||||||||||||||||||||||||||||||
| 285 | ['e'], | ||||||||||||||||||||||||||||||||||||||||||
| 286 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | sub _css_class { | ||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | my ($self, $suffix) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_css_class: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | return $self->{'css_pager'}.'-'.$suffix; | |||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | sub _css_colors_optional { | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | my ($self, $css_color, $css_key) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_css_colors_optional: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | return defined $self->{'css_colors'}->{$css_color} | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | ? (['d', $css_key, $self->{'css_colors'}->{$css_color}]) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | : (); | ||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | __END__ | ||||||||||||||||||||||||||||||||||||||||||