From 9d7d13a80aeaa4b60b55659a4ee4fb24ab6248ee Mon Sep 17 00:00:00 2001 From: schneefux Date: Mon, 15 Aug 2016 19:27:09 +0200 Subject: introduce featured tags --- app.py | 2 ++ config-template.py | 1 + templates/index.html | 12 +++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 28d2906..8f66efc 100644 --- a/app.py +++ b/app.py @@ -529,6 +529,7 @@ def page(num): sortmethod = str(request.args.get('sort')) or 'rank' if search: # TODO find a cleaner way + # visual: #, actual: _ search = re.sub(r"^" + Markup.tagmark, "#", search) search = search.split(Markup.spacemark) perpage = abs(int(request.args.get('perpage') or 10)) @@ -546,6 +547,7 @@ def page(num): jokes=jokes, abusemail=config['abusemail'], title=config['title'], + featured=config['featured'], user=user)) resp.headers.set('X-SmoothState-Location', request.path + "?" + diff --git a/config-template.py b/config-template.py index f673bff..2fc1310 100644 --- a/config-template.py +++ b/config-template.py @@ -3,5 +3,6 @@ config = { 'debug': False, 'superuser': 'admin', 'abusemail': 'admin@host.example.com', + 'featured': ['sticky'], 'title': 'My awesome voting page' } diff --git a/templates/index.html b/templates/index.html index 8af43ee..b940bb2 100644 --- a/templates/index.html +++ b/templates/index.html @@ -79,14 +79,24 @@ {% endif %} {% endwith %} - {% if tags %} + {% if tags or featured %}
+ {% if tags %} {% for tag in tags %}
{{ tag }} close
{% endfor %} + {% endif %} + + {% if featured %} +

Empfohlen: + {% for tag in featured %} + #{{ tag }} + {% endfor %} +

+ {% endif %}
{% endif %} {% if jokes|length > 0 %} -- cgit v1.3.1