forked from extern/django-helpdesk
add first and last page controls
This commit is contained in:
parent
d9cb76d491
commit
df6a8a3778
@ -39,24 +39,31 @@
|
||||
<!-- /.table-responsive -->
|
||||
{% if ticket_list.has_other_pages %}
|
||||
<ul class="pagination">
|
||||
<!-- if we aren't on page one, go back to start and go back one controls -->
|
||||
{% if ticket_list.has_previous %}
|
||||
<li><a href=?{{ page_var }}=1">««</a></li>
|
||||
<li><a href="?{{ page_var }}={{ ticket_list.previous_page_number }}">«</a></li>
|
||||
{% else %}
|
||||
<li class="disabled"><span>««</span></li>
|
||||
<li class="disabled"><span>«</span></li>
|
||||
{% endif %}
|
||||
<!-- Page - 5 to page + 5 controls -->
|
||||
{% with ''|center:11 as range %}
|
||||
{% for _ in range %}
|
||||
{% with (ticket_list.number + (forloop.counter-5)) as i %}
|
||||
{% with ticket_list.number+forloop.counter-5 as i %}
|
||||
{% if ticket_list.number == i %}
|
||||
<li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
|
||||
{% else %}
|
||||
{% else if ticket_list.pages%}
|
||||
<li><a href="?{{ page_var }}={{ i }}">{{ i }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<!-- if we aren't on the last page, go forward one and go to end controls -->
|
||||
{% if ticket_list.has_next %}
|
||||
<li><a href="?{{ page_var }}={{ ticket_list.next_page_number }}">»</a></li>
|
||||
<li><a href=?{{ page_var }}={{ ticket_list.paginator.num_pages }}">»»</a></li>
|
||||
{% else %}
|
||||
<li class="disabled"><span>»</span></li>
|
||||
<li class="disabled"><span>»»</span></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user