Add pagination links

This commit is contained in:
Bat
2018-07-25 14:29:34 +02:00
parent 5549e4d0e5
commit 04dac6f87f
8 changed files with 47 additions and 1 deletions
+1
View File
@@ -36,5 +36,6 @@
{{ macros::post_card(article=article) }}
{% endfor %}
</div>
{{ macros::paginate(page=page, total=n_pages) }}
</section>
{% endblock content %}
+10
View File
@@ -35,3 +35,13 @@
{% endif %}
<input type="{{ type }}" id="{{ name }}" name="{{ name }}" value="{{ form[name] | default(value="") }}" {{ props | safe }}/>
{% endmacro input %}
{% macro paginate(page, total, previous="Previous page", next="Next page") %}
<div class="pagination">
{% if page != 1 %}
<a href="?page={{ page - 1 }}">{{ previous | _ }}</a>
{% endif %}
{% if page < total %}
<a href="?page={{ page + 1 }}">{{ next | _ }}</a>
{% endif %}
</div>
{% endmacro %}