-
Notifications
You must be signed in to change notification settings - Fork 8
/
pagination.drupal.liquid
56 lines (51 loc) · 1.45 KB
/
pagination.drupal.liquid
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
49
50
51
52
53
54
55
56
{% comment %}
paginator {
prev: url or null
page {
href: url or null
class:
href:
label
}
prev: url or null
}
{% endcomment %}
{% assign paginatorCount = paginator.inner | size %}
{% assign totalItems = paginatorCount %}
{% if numItems %}
{% assign totalItems = numItems | times: .1 %}
{% endif%}
{% if paginator != empty and totalItems <= paginatorCount %}
<div class="va-pagination" data-template="includes/pagination">
{% if paginator.prev != empty %}
<span class="va-pagination-prev">
<a href="{{ paginator.prev }}" aria-label="Load previous page{{ paginator.ariaLabel }}">
<abbr title="Previous">Prev</abbr>
</a>
</span>
{% endif %}
<div class="va-pagination-inner">
{% for page in paginator.inner %}
<a
aria-label="Load page {{ page.label }}{{ paginator.ariaLabel }}"
{% if page.class %}
class="{{ page.class }}"
{% endif %}
{% if page.class != "va-pagination-active" %}
href="{{ page.href }}"
{% endif %}
>
{{ page.label }}
</a>
{% assign totalItems = totalItems | minus: 1 %}
{% endfor %}
</div>
{% if paginator.next != empty %}
<span class="va-pagination-next">
<a href="{{ paginator.next }}" aria-label="Load next page{{ paginator.ariaLabel }}">
Next
</a>
</span>
{% endif %}
</div>
{% endif %}