initial commit
This commit is contained in:
commit
e869a1cab4
107 changed files with 9029 additions and 0 deletions
61
app/views/_partials/pagination.volt
Normal file
61
app/views/_partials/pagination.volt
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
|
||||
{%- macro max(a, b) %}
|
||||
{% return a > b ? a : b %}
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro min(a, b) %}
|
||||
{% return a < b ? a : b %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% set pagination_slider = 2 %}
|
||||
|
||||
{% if (page.total_pages > 1) %}
|
||||
|
||||
<ul class="pagination">
|
||||
|
||||
{% if page.current !== page.before %}
|
||||
<li>
|
||||
<a href="{{ pagination_url ~ page.before }}">
|
||||
{{ icon('android-arrow-back') }} Previous
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if page.total_pages > pagination_slider and page.current > pagination_slider %}
|
||||
<li>
|
||||
<a href="{{ pagination_url ~ 1 }}">1</a>
|
||||
</li>
|
||||
<li class="middle">
|
||||
...
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for n in max(page.current - pagination_slider, 1)..min(page.current + pagination_slider, page.total_pages) %}
|
||||
{% if (n == page.current) %}
|
||||
<li class="active">
|
||||
{% else %}
|
||||
<li>
|
||||
{% endif %}
|
||||
<a href="{{ pagination_url ~ n }}">{{ n }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
{% if page.total_pages > pagination_slider and page.current < page.total_pages - pagination_slider %}
|
||||
<li class="middle">
|
||||
...
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ pagination_url ~ page.total_pages }}">{{ page.total_pages }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if page.current !== page.next %}
|
||||
<li>
|
||||
<a href="{{ pagination_url ~ page.next }}">
|
||||
Next {{ icon('android-arrow-forward') }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
{% endif %}
|
||||
Reference in a new issue