forked from jasongrimes/php-paginator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pagerSmall.twig
49 lines (45 loc) · 1.82 KB
/
pagerSmall.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{% if paginator.numPages > 1 %}
<div class="input-group" style="width: 1px;">
{% if paginator.prevUrl %}
<span class="input-group-btn">
<a href="{{ paginator.prevUrl }}" class="btn btn-default" type="button">« Prev</a>
</span>
{% endif %}
<select class="form-control paginator-select-page" style="width: auto; cursor: pointer; -webkit-appearance: none; -moz-appearance: none; appearance: none;">
{% for page in paginator.pages %}
{% if page.url %}
<option value="{{ page.url }}"{{ page.isCurrent ? 'selected' : '' }}>
Page {{ page.num }}
</option>
{% else %}
<option disabled>{{ page.num }}</option>
{% endif %}
{% endfor %}
</select>
{% if paginator.nextUrl %}
<span class="input-group-btn">
<a href="{{ paginator.nextUrl }}" class="btn btn-default" type="button">Next »</a>
</span>
{% endif %}
</div>
{% endif %}
{# Depends on this little bit of javascript being included somewhere:
$(function() {
$('.paginator-select-page').on('change', function() {
document.location = $(this).val();
});
// Workaround to prevent iOS from zooming the page when clicking the select list:
$('.paginator-select-page')
.on('focus', function() {
if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent)) {
$(this).css('font-size', '16px');
}
})
.on('blur', function() {
if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent)) {
$(this).css('font-size', '');
}
})
;
});
#}