diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2016-08-15 19:27:09 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-08-15 19:27:09 +0200 |
| commit | 9d7d13a80aeaa4b60b55659a4ee4fb24ab6248ee (patch) | |
| tree | 7cef828f908b96b55559d6ae8b97a70b9443cd36 | |
| parent | ef35bb66e34354c1d6987acb4d2e1d3e6aae2664 (diff) | |
| download | jokevote-9d7d13a80aeaa4b60b55659a4ee4fb24ab6248ee.tar.gz jokevote-9d7d13a80aeaa4b60b55659a4ee4fb24ab6248ee.zip | |
introduce featured tags
| -rw-r--r-- | app.py | 2 | ||||
| -rw-r--r-- | config-template.py | 1 | ||||
| -rw-r--r-- | templates/index.html | 12 |
3 files changed, 14 insertions, 1 deletions
@@ -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 @@ </div> {% endif %} {% endwith %} - {% if tags %} + {% if tags or featured %} <div class="section"> + {% if tags %} {% for tag in tags %} <div class="chip"> {{ tag }} <a href="/{{ query(search=tags|reject('sameas', tag)|join('+')) }}"><i class="material-icons">close</i></a> </div> {% endfor %} + {% endif %} + + {% if featured %} + <p>Empfohlen: + {% for tag in featured %} + <a href="/{{ query(search='_'+tag) }}">#{{ tag }}</a> + {% endfor %} + </p> + {% endif %} </div> {% endif %} {% if jokes|length > 0 %} |
