mirror of
https://github.com/evennia/evennia.git
synced 2026-03-31 21:17:17 +02:00
Adds pagination and incorporates on base template where applicable.
This commit is contained in:
parent
06b7b74a27
commit
d124c0630b
2 changed files with 36 additions and 0 deletions
|
|
@ -46,6 +46,8 @@
|
|||
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
|
||||
{% include 'website/pagination.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
34
evennia/web/website/templates/website/pagination.html
Normal file
34
evennia/web/website/templates/website/pagination.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{% if page_obj %}
|
||||
<div class="container main-content mt-2" id="pagination">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
<!-- Pagination -->
|
||||
<ul class="pagination justify-content-center mb-0">
|
||||
<li class="page-item {% if page_obj.has_previous %}{% else %}disabled{% endif %}">
|
||||
<a class="page-link" href="{% if page_obj.has_previous %}?{% if q %}q={{ q }}&{% endif %}page={{ page_obj.previous_page_number }}{% endif %}" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% for l in page_obj.paginator.page_range %}
|
||||
{% if l <= page_obj.number|add:5 and l >= page_obj.number|add:-5 %}
|
||||
<li class="page-item {% if forloop.counter == page_obj.number %}active{% endif %}"><a class="page-link" href="?{% if q %}q={{ q }}&{% endif %}page={{ forloop.counter }}">{{ forloop.counter }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<li class="page-item {% if page_obj.has_next %}{% else %}disabled{% endif %}">
|
||||
<a class="page-link" href="{% if page_obj.has_next %}?{% if q %}q={{ q }}&{% endif %}page={{ page_obj.next_page_number }}{% endif %}" aria-label="Next">
|
||||
<span aria-hidden="true">»</span>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue