diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2016-06-10 20:40:04 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-06-10 20:40:04 +0200 |
| commit | ae3eb5ff7ab20b4c7033c616fb33d790da83c022 (patch) | |
| tree | 6018ef8f2f0d6df30fc2762cb37f07b1f42c7d3c | |
| parent | 994452c91ee9d1f6eb4aa6bc293e64a09f55c4b9 (diff) | |
| download | jokevote-ae3eb5ff7ab20b4c7033c616fb33d790da83c022.tar.gz jokevote-ae3eb5ff7ab20b4c7033c616fb33d790da83c022.zip | |
paginate filtered results properly
| -rw-r--r-- | app.py | 1 | ||||
| -rw-r--r-- | templates/index.html | 8 |
2 files changed, 5 insertions, 4 deletions
@@ -452,6 +452,7 @@ def page(num): render_template( 'index.html', currentpage=num, + query=str(request.query_string, 'utf-8'), tag=search, perpage=PERPAGE, jokes=jokes, diff --git a/templates/index.html b/templates/index.html index dc75288..c83d78c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -35,7 +35,7 @@ </form> {% endif %} <div class="col s2 m12 l2 right"> - <a class="btn-floating btn-large right" href="/export"><i class="material-icons">file_download</i></a> + <a class="btn-floating btn-large right" href="/export{% if query %}?{{ query }}{% endif %}"><i class="material-icons">file_download</i></a> </div> </div> </header> @@ -111,11 +111,11 @@ </ul> <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> + <li{% if currentpage==0 %} class="disabled"{% endif %}><a href="/page/{{ currentpage-1 }}{% if query %}?{{ query }}{% endif %}"><i class="material-icons">chevron_left</i></a></li> {% for page in range((jokes|length/perpage)|round(0, 'ceil')|int) %} - <li{% if currentpage==loop.index0 %} class="active"{% endif %}><a href="/page/{{ loop.index0 }}">{{ loop.index }}</a></li> + <li{% if currentpage==loop.index0 %} class="active"{% endif %}><a href="/page/{{ loop.index0 }}{% if query %}?{{ query }}{% endif %}">{{ 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> + <li{% if currentpage==loop.length-1 %} class="disabled"{% endif %}><a href="/page/{{ currentpage+1 }}{% if query %}?{{ query }}{% endif %}"><i class="material-icons">chevron_right</i></a></li> </ul> </div> <div class="divider"></div> |
