| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Moonshine::Bootstrap::Component::Pager; |
|
2
|
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
275092
|
use Moonshine::Magic; |
|
|
5
|
|
|
|
|
116525
|
|
|
|
5
|
|
|
|
|
47
|
|
|
4
|
5
|
|
|
5
|
|
3065
|
use Moonshine::Util; |
|
|
5
|
|
|
|
|
29
|
|
|
|
5
|
|
|
|
|
59
|
|
|
5
|
5
|
|
|
5
|
|
3045
|
use Params::Validate qw/ARRAYREF HASHREF/; |
|
|
5
|
|
|
|
|
14
|
|
|
|
5
|
|
|
|
|
417
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
666
|
use Switch::Back; |
|
|
5
|
|
|
|
|
1230566
|
|
|
|
5
|
|
|
|
|
60
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends ( |
|
10
|
|
|
|
|
|
|
'Moonshine::Bootstrap::Component', |
|
11
|
|
|
|
|
|
|
'Moonshine::Bootstrap::Component::Pagination', |
|
12
|
|
|
|
|
|
|
); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has( |
|
15
|
|
|
|
|
|
|
pager_spec => sub { |
|
16
|
|
|
|
|
|
|
{ |
|
17
|
|
|
|
|
|
|
tag => { default => 'ul' }, |
|
18
|
|
|
|
|
|
|
class_base => { default => 'pager', base => 1 }, |
|
19
|
|
|
|
|
|
|
items => { type => ARRAYREF, optional => 1, base => 1 }, |
|
20
|
|
|
|
|
|
|
previous => { |
|
21
|
|
|
|
|
|
|
default => { |
|
22
|
|
|
|
|
|
|
span => { data => 'Previous' }, |
|
23
|
|
|
|
|
|
|
link => { href => '#' }, |
|
24
|
|
|
|
|
|
|
}, |
|
25
|
|
|
|
|
|
|
type => HASHREF, |
|
26
|
|
|
|
|
|
|
base => 1, |
|
27
|
|
|
|
|
|
|
}, |
|
28
|
|
|
|
|
|
|
next => { |
|
29
|
|
|
|
|
|
|
default => { |
|
30
|
|
|
|
|
|
|
span => { data => 'Next' }, |
|
31
|
|
|
|
|
|
|
link => { href => "#" } |
|
32
|
|
|
|
|
|
|
}, |
|
33
|
|
|
|
|
|
|
type => HASHREF, |
|
34
|
|
|
|
|
|
|
base => 1, |
|
35
|
|
|
|
|
|
|
}, |
|
36
|
|
|
|
|
|
|
aligned => 0, |
|
37
|
|
|
|
|
|
|
disable => { build => 1, optional => 1 }, |
|
38
|
|
|
|
|
|
|
nav => { optional => 1, base => 1 }, |
|
39
|
|
|
|
|
|
|
nav_args => { optional => 1, base => 1 }, |
|
40
|
|
|
|
|
|
|
}; |
|
41
|
|
|
|
|
|
|
}, |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub pager { |
|
45
|
9
|
|
|
9
|
|
140534
|
my ($self) = shift; |
|
46
|
|
|
|
|
|
|
|
|
47
|
9
|
|
100
|
|
|
134
|
my ( $base_args, $build_args ) = $self->validate_build( |
|
48
|
|
|
|
|
|
|
{ |
|
49
|
|
|
|
|
|
|
params => $_[0] // {}, |
|
50
|
|
|
|
|
|
|
spec => $self->pager_spec, |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
); |
|
53
|
|
|
|
|
|
|
|
|
54
|
9
|
100
|
|
|
|
104
|
if ( $build_args->{aligned} ) { |
|
55
|
7
|
|
|
|
|
35
|
$base_args->{previous}->{class} .= 'previous'; |
|
56
|
7
|
|
|
|
|
29
|
$base_args->{next}->{class} .= 'next'; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
9
|
|
|
|
|
22
|
|
|
59
|
9
|
|
|
|
|
19
|
given ( $build_args->{disable} ) { |
|
|
9
|
|
|
|
|
48
|
|
|
|
9
|
|
|
|
|
23
|
|
|
60
|
9
|
|
|
|
|
27
|
my $dis = 'disabled'; |
|
61
|
9
|
50
|
|
|
|
49
|
when ('previous') { |
|
|
0
|
50
|
|
|
|
0
|
|
|
|
|
100
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$base_args->{previous}->{class} = |
|
63
|
0
|
|
|
|
|
0
|
prepend_str( $dis, $base_args->{previous}->{class} ); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
when ('next') { |
|
66
|
|
|
|
|
|
|
$base_args->{next}->{class} = |
|
67
|
0
|
|
|
|
|
0
|
prepend_str( $dis, $base_args->{next}->{class} ); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
when ('both') { |
|
70
|
|
|
|
|
|
|
$base_args->{next}->{class} = |
|
71
|
5
|
|
|
|
|
1784
|
prepend_str( $dis, $base_args->{next}->{class} ); |
|
72
|
|
|
|
|
|
|
$base_args->{previous}->{class} = |
|
73
|
5
|
|
|
|
|
55
|
prepend_str( $dis, $base_args->{previous}->{class} ); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
9
|
|
|
|
|
1418
|
return $self->pagination($base_args); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |