aboutsummaryrefslogtreecommitdiff
path: root/templates/macros/paging.html
blob: 59ba61721218a9d01f20cb85a5aedb9024232832 (plain)
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
{% macro paging(url, page, max_page) %}
  {% if url is containing("?") %}
    {% set sign = "&" %}
  {% else %}
    {% set sign = "?" %}
  {% endif %}

  <div class="g-Paging">
    {% if page > 1 %}
      <a
        class="g-Paging__Link g-Paging__Link--Active"
        href="{{ url }}"
      >
        ❬❬
      </a>
      <a
        class="g-Paging__Link g-Paging__Link--Active"
        href="{{ url }}{{ sign }}page={{ page - 1 }}"
      ></a>
    {% else %}
      <span class="g-Paging__Link">
        ❬❬
      </span>
      <span class="g-Paging__Link"></span>
    {% endif %}

    {{ page }} / {{ max_page }}

    {% if page < max_page %}
      <a
        class="g-Paging__Link g-Paging__Link--Active"
        href="{{ url }}{{ sign }}page={{ page + 1 }}"
      ></a>
      <a
        class="g-Paging__Link g-Paging__Link--Active"
        href="{{ url }}{{ sign }}page={{ max_page }}"
      >
        ❭❭
      </a>
    {% else %}
      <span class="g-Paging__Link"></span>
      <span class="g-Paging__Link">
        ❭❭
      </span>
    {% endif %}
  </div>
{% endmacro paging %}