-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #450 from ox-it/pagination-show-page-numbers
Pagination: show page numbers
- Loading branch information
Showing
1 changed file
with
27 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,35 @@ | ||
<div class="col-sm-offset-5 col-lg-offset-5 col-sm-5 col-lg-5"> | ||
<div style="text-align:center;"> | ||
<span class="step-links"> | ||
|
||
<ul class="pagination pagination-sm"> | ||
{% if page.has_previous %} | ||
<a class="btn btn-default" href="?{{ fragment }}&page={{ page.previous_page_number }}">previous</a> | ||
<li><a class="btn btn-default" href="?{{ fragment }}&page={{ page.previous_page_number }}">previous</a></li> | ||
<li><a style="visibility:hidden"> </a></li> | ||
<li class="hidden-lg"><a style="border:0px;">Page {{ page.number }} of {{ page.paginator.num_pages }}</a></li> | ||
{% endif %} | ||
|
||
<span class="current"> | ||
Page {{ page.number }} of {{ page.paginator.num_pages }}. | ||
</span> | ||
{% if page.paginator.num_pages <= 1 %} | ||
<li class="active"><a>Page 1</a></li> | ||
{% else %} | ||
{% for p in page.paginator.page_range %} | ||
{% if p == 1 or p == page.paginator.num_pages or p <= page.number|add:2 and p >= page.number|add:-2 %} | ||
<li class="visible-lg-inline{% if p == page.number %} active{% endif %}"> | ||
<a href="?{{ fragment }}&page={{ p }}"> | ||
{{ p }} | ||
</a> | ||
</li> | ||
{% else %} | ||
{% if p == 2 or p == page.paginator.num_pages|add:-1 %} | ||
<li class="visible-lg-inline"><a style="border-top:0px; border-bottom:0px;">...</a></li> | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{% if page.has_next %} | ||
<a class="btn btn-default" href="?{{ fragment }}&page={{ page.next_page_number }}">next</a> | ||
<li><a style="visibility:hidden"> </a></li> | ||
<li><a class="btn btn-default" href="?{{ fragment }}&page={{ page.next_page_number }}">next</a></li> | ||
{% endif %} | ||
</ul> | ||
</span> | ||
</div> | ||
</div> |