mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 10:34:21 +00:00
fix pagination macro and add ellision
This commit is contained in:
parent
6179c3e7d4
commit
6449724ed5
@ -156,34 +156,36 @@
|
|||||||
</nav>
|
</nav>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro paginate_jinja(page, nb_pages) %}
|
{% macro paginate_jinja(current_page, paginator) %}
|
||||||
<nav class="pagination">
|
<nav class="pagination">
|
||||||
{% if page <= 1 %}
|
{% if current_page.has_previous() %}
|
||||||
<button disabled="disabled"><i class="fa fa-caret-left"></i></button>
|
<a href="?page={{ current_page.previous_page_number() }}">
|
||||||
{% else %}
|
|
||||||
<a href="?href={{ page - 1 }}">
|
|
||||||
<button>
|
<button>
|
||||||
<i class="fa fa-caret-left"></i>
|
<i class="fa fa-caret-left"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<button disabled="disabled"><i class="fa fa-caret-left"></i></button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for i in range(1, nb_pages + 1) %}
|
{% for i in paginator.get_elided_page_range(current_page.number) %}
|
||||||
{% if i == page %}
|
{% if i == current_page.number %}
|
||||||
<button class="active">{{ i }}</button>
|
<button class="active">{{ i }}</button>
|
||||||
|
{% elif i == paginator.ELLIPSIS %}
|
||||||
|
<strong>{{ paginator.ELLIPSIS }}</strong>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="?page={{ i }}">
|
<a href="?page={{ i }}">
|
||||||
<button>{{ i }}</button>
|
<button>{{ i }}</button>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if page >= nb_pages %}
|
{% if current_page.has_next() %}
|
||||||
<button disabled="disabled"><i class="fa fa-caret-right"></i></button>
|
<a href="?page={{ current_page.next_page_number() }}">
|
||||||
{% else %}
|
|
||||||
<a href="?href={{ page - 1 }}">
|
|
||||||
<button>
|
<button>
|
||||||
<i class="fa fa-caret-right"></i>
|
<i class="fa fa-caret-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<button disabled="disabled"><i class="fa fa-caret-right"></i></button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</nav>
|
</nav>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
{{ display_search_bar(request) }}
|
{{ display_search_bar(request) }}
|
||||||
{{ paginate_jinja(msgs.number, msgs.paginator.num_pages) }}
|
{{ paginate_jinja(msgs, msgs.paginator) }}
|
||||||
|
|
||||||
<main class="message-list">
|
<main class="message-list">
|
||||||
{% for m in msgs %}
|
{% for m in msgs %}
|
||||||
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
<p><a class="ib button" href="{{ url('forum:new_message', topic_id=topic.id) }}">{% trans %}Reply{% endtrans %}</a></p>
|
<p><a class="ib button" href="{{ url('forum:new_message', topic_id=topic.id) }}">{% trans %}Reply{% endtrans %}</a></p>
|
||||||
|
|
||||||
{{ paginate_jinja(msgs.number, msgs.paginator.num_pages) }}
|
{{ paginate_jinja(msgs, msgs.paginator) }}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user