From 3e410e0a7ab2e167f0238f4ad427317539edc565 Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Fri, 22 Jul 2016 09:34:07 +0200 Subject: [PATCH] Show header with tag instead of Bookmarks --- digimarks.py | 6 ++++-- templates/bookmarks.html | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/digimarks.py b/digimarks.py index 7bf959a..25847d4 100644 --- a/digimarks.py +++ b/digimarks.py @@ -251,7 +251,8 @@ def addingbookmark(userkey): #bookmark = Bookmark(url=url, title=title, starred=starred, userkey=userkey) bookmark, created = Bookmark.get_or_create(url=url, userkey=userkey) if not created: - return redirect(url_for('editbookmark', userkey=userkey, urlhash=bookmark.url_hash, message='Existing bookmark, did not overwrite with new values')) + message = 'Existing bookmark, did not overwrite with new values' + return redirect(url_for('editbookmark', userkey=userkey, urlhash=bookmark.url_hash, message=message)) # Newly created, set properties bookmark.title = title @@ -296,7 +297,8 @@ def tag(userkey, tag): """ Overview of all bookmarks with a certain tag """ bookmarks = Bookmark.select().where(Bookmark.userkey == userkey, Bookmark.tags.contains(tag)) tags = get_tags_for_user(userkey) - return render_template('bookmarks.html', bookmarks=bookmarks, userkey=userkey, tags=tags) + pageheader = 'tag: ' + tag + return render_template('bookmarks.html', bookmarks=bookmarks, userkey=userkey, tags=tags, action=pageheader) @app.route('//adduser') diff --git a/templates/bookmarks.html b/templates/bookmarks.html index 2459623..893ec6f 100644 --- a/templates/bookmarks.html +++ b/templates/bookmarks.html @@ -1,6 +1,9 @@ {% extends "base.html" %} -{% block title %}Bookmarks{% endblock %} -{% block pageheader %}Bookmarks{% endblock %} +{% if not action %} +{% set action = 'Bookmarks' %} +{% endif %} +{% block title %}{{ action }}{% endblock %} +{% block pageheader %}{{ action }}{% endblock %} {% block pagecontent %} {% if message %}