summaryrefslogtreecommitdiff
path: root/templates/index.html
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2016-06-10 17:57:54 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2016-06-10 17:57:54 +0200
commit052e4966c77ff4a47a99296ca1bbb39a8b11e8e9 (patch)
treebed051ae7572ec1c465a170991360356990b08ef /templates/index.html
parent02415a36adba08f228d77b860530e6b6dc7c53ec (diff)
downloadjokevote-052e4966c77ff4a47a99296ca1bbb39a8b11e8e9.tar.gz
jokevote-052e4966c77ff4a47a99296ca1bbb39a8b11e8e9.zip
handle pagination in template
Diffstat (limited to 'templates/index.html')
-rw-r--r--templates/index.html4
1 files changed, 2 insertions, 2 deletions
diff --git a/templates/index.html b/templates/index.html
index db3cbda..6957d21 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -50,7 +50,7 @@
{% endif %}
{% endwith %}
<ul class="collection">
- {% for joke in jokes %}
+ {% for joke in jokes[currentpage*perpage:(currentpage+1)*perpage] %}
<li class="collection-item row valign-wrapper">
<div class="col s4 m2 valign">
{% if not joke.deleted %}
@@ -113,7 +113,7 @@
<div class="section center">
<ul class="pagination">
<li{% if currentpage==0 %} class="disabled"{% endif %}><a href="/page/{{ currentpage-1 }}"><i class="material-icons">chevron_left</i></a></li>
- {% for page in pages %}
+ {% for page in range(jokes|length//perpage+1) %}
<li{% if currentpage==loop.index0 %} class="active"{% endif %}><a href="/page/{{ loop.index0 }}">{{ loop.index }}</a></li>
{% endfor %}
<li{% if currentpage==loop.length-1 %} class="disabled"{% endif %}><a href="/page/{{ currentpage+1 }}"><i class="material-icons">chevron_right</i></a></li>