38 lines
1.2 KiB
HTML
38 lines
1.2 KiB
HTML
<!-- /app/templates/_pagination_floating.html -->
|
||
{% set total_pages = images.pages %}
|
||
{% set current_page = images.page %}
|
||
{% set endpoint = request.endpoint %}
|
||
|
||
{# Build a merged param dict: query args + path args #}
|
||
{% set params = request.args.to_dict(flat=True) %}
|
||
{% for k, v in request.view_args.items() %}
|
||
{% set _ = params.update({k: v}) %}
|
||
{% endfor %}
|
||
|
||
{# Helper to make a page URL while preserving all other params #}
|
||
{% macro page_url(p) -%}
|
||
{%- set pmap = params.copy() -%}
|
||
{%- set _ = pmap.update({'page': p}) -%}
|
||
{{ url_for(endpoint, **pmap) }}
|
||
{%- endmacro %}
|
||
|
||
<div class="floating-pagination">
|
||
<a class="fp-btn fp-prev {% if not images.has_prev %}disabled{% endif %}"
|
||
{% if images.has_prev %}href="{{ page_url(images.prev_num) }}"{% endif %}
|
||
title="Previous page">
|
||
‹
|
||
</a>
|
||
|
||
<span class="fp-indicator">
|
||
<span class="fp-current">{{ current_page }}</span>
|
||
<span class="fp-sep">/</span>
|
||
<span class="fp-total">{{ total_pages }}</span>
|
||
</span>
|
||
|
||
<a class="fp-btn fp-next {% if not images.has_next %}disabled{% endif %}"
|
||
{% if images.has_next %}href="{{ page_url(images.next_num) }}"{% endif %}
|
||
title="Next page">
|
||
›
|
||
</a>
|
||
</div>
|