From 3b00ef043d136458341d3e801cca1af5c26aff62 Mon Sep 17 00:00:00 2001 From: schneefux Date: Sun, 19 Jun 2016 21:19:15 +0200 Subject: improve query handling; fix query disappearing --- app.py | 6 +++--- templates/index.html | 31 +++++++++++++++++++------------ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/app.py b/app.py index e060f13..9f8a38d 100644 --- a/app.py +++ b/app.py @@ -537,18 +537,18 @@ def page(num): user['loggedin'] = True user['name'] = session['userlogin'] resp = make_response( - # TODO clean this up render_template( 'index.html', currentpage=num, - query=str(request.query_string, 'utf-8'), selected_sort=sortmethod, tags=search, perpage=perpage, jokes=jokes, abusemail=config['abusemail'], user=user)) - resp.headers.set('X-SmoothState-Location', request.path) + resp.headers.set('X-SmoothState-Location', + request.path + "?" + + str(request.query_string, "utf-8")) return resp diff --git a/templates/index.html b/templates/index.html index 296490a..3a76f28 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,3 +1,4 @@ +{% macro query(search, sort) %}?filter={{ search if search is defined else request.args.get("filter") or "" }}&sort={{ sort if sort is defined else request.args.get("sort") or "" }}{% endmacro %} @@ -29,7 +30,7 @@
  • - + file_download
  • @@ -45,7 +46,7 @@ + {% else %} +
    +

    Nichts gefunden.

    +
    + {% endif %} {% if jokes|length > perpage %}
    {% endif %} @@ -157,7 +164,7 @@ add -