AACResults/templates/prevnext.html

46 lines
1.9 KiB
HTML

<nav class="nextprev">
{%- set ns.prev = getstart - getshow -%}
{%- if ns.prev == 0 -%}
{%- set ns.prev = None -%}
{%- endif -%}
{%- set ns.next = getstart + getshow -%}
{%- if ns.next == 0 -%}
{%- set ns.next = None -%}
{%- endif -%}
{%- set thispage = (getstart / getshow)|round(0,'floor')|int + 1 -%}
{%- set totalpages = (ns.total / getshow)|round(0,'ceil')|int -%}
{%- set ns.ellipsis = False -%}
{% if thispage > 1 %}
<span class="first"><a href="{{ url_for(request.endpoint, title=title, year=year, start=None, show=show) }}">&laquo; First</a></span>
{% if (getstart - getshow) > 1 %}
<span class="prev"><a href="{{ url_for(request.endpoint, title=title, year=year, start=ns.prev, show=show) }}">&lsaquo; Prev</a></span>
{% endif %}
{% endif %}
{% for page in range(1, totalpages+1) %}
{% if page < 4 or page > (totalpages+1-4) or (page > (thispage-3) and page < (thispage+3)) %}
{%- if page != thispage -%}
<span class="nav link"><a href="{{ url_for(request.endpoint, title=title, year=year, start=(page - 1) * getshow, show=show) }}">{{ page }}</a></span>
{%- else -%}
<span class="nav plain"><strong>{{ page }}</strong></span>
{%- endif %}
{%- set ns.ellipsis = False -%}
{%- else -%}
{%- if not ns.ellipsis -%}
<span class="nav plain">&hellip;</span>
{%- endif -%}
{%- set ns.ellipsis = True -%}
{% endif %}
{% endfor %}
{% if thispage < totalpages %}
{% if (getstart + getshow) != (totalpages - 1) * getshow %}
<span class="next"><a href="{{ url_for(request.endpoint, title=title, year=year, start=ns.next, show=show) }}">Next &rsaquo;</a></span>
{% endif %}
<span class="last"><a href="{{ url_for(request.endpoint, title=title, year=year, start=(totalpages - 1) * getshow, show=show) }}">Last &raquo;</a></span>
{% endif %}
</nav>