mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 12:49:01 +02:00

Use a Django snippet to make pagination display a bit nicer (compressed form instead of showing all page numbers). In order to interact properly with GET requests, an additional snippet was required to add parameters to the URL (why doesn't Django provide this out of the box?). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
58 lines
1.7 KiB
HTML
58 lines
1.7 KiB
HTML
{% comment %}
|
|
|
|
layerindex-web - pagination template
|
|
|
|
Copyright (C) 2013 Intel Corporation
|
|
Licensed under the MIT license, see COPYING.MIT for details
|
|
|
|
{% endcomment %}
|
|
|
|
{% load addurlparameter %}
|
|
|
|
<div class="pagination pagination-centered">
|
|
<ul>
|
|
{% if page.has_previous %}
|
|
<li><a href="{% addurlparameter 'page' page.previous_page_number %}">prev</a></li>
|
|
{% else %}
|
|
<li class="disabled"><span>prev</span></li>
|
|
{% endif %}
|
|
|
|
|
|
{% for pnum in begin %}
|
|
{% if pnum == page.number %}
|
|
<li class="active"><a href="#">{{ page.number }}</a></li>
|
|
{% else %}
|
|
<li><a href="{% addurlparameter 'page' pnum %}">{{ pnum }}</a></li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if middle %}
|
|
<li class="disabled"><span>...</span></li>
|
|
{% for pnum in middle %}
|
|
{% if pnum == page.number %}
|
|
<li class="active"><span>{{ page.number }}</span></li>
|
|
{% else %}
|
|
<li><a href="{% addurlparameter 'page' pnum %}">{{ pnum }}</a></li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% if end %}
|
|
<li class="disabled"><span>...</span></li>
|
|
{% for pnum in end %}
|
|
{% if pnum == page.number %}
|
|
<li class="active"><span>{{ page.number }}</span></li>
|
|
{% else %}
|
|
<li><a href="{% addurlparameter 'page' pnum %}">{{ pnum }}</a></li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% if page.has_next %}
|
|
<li><a href="{% addurlparameter 'page' page.next_page_number %}">next</a></li>
|
|
{% else %}
|
|
<li class="disabled"><span>next</span></li>
|
|
{% endif %}
|
|
</ul>
|
|
</div>
|