1
0
mirror of https://github.com/aquatix/digimarks.git synced 2025-12-07 00:15:10 +01:00

Way better tag overview page, with public links

This commit is contained in:
2016-08-13 14:42:15 +02:00
parent 53b96adc79
commit c70ac6d781
2 changed files with 38 additions and 6 deletions

View File

@@ -415,7 +415,16 @@ def deletingbookmark(userkey, urlhash):
def tags(userkey):
""" Overview of all tags used by user """
tags = get_cached_tags(userkey)
return render_template('tags.html', tags=tags, userkey=userkey)
#publictags = PublicTag.select().where(Bookmark.userkey == userkey)
alltags = []
for tag in tags:
try:
publictag = PublicTag.get(PublicTag.userkey == userkey, PublicTag.tag == tag)
except PublicTag.DoesNotExist:
publictag = None
total = 'n/a' # TODO: count number of bookmarks with this tag
alltags.append({'tag': tag, 'publictag': publictag, 'total': total})
return render_template('tags.html', tags=alltags, userkey=userkey)
@app.route('/<userkey>/tag/<tag>')

View File

@@ -4,11 +4,34 @@
{% block pagecontent %}
<div class="row">
{% for tag in tags %}
<div class="chip">
<a href="{{ url_for('tag', userkey=userkey, tag=tag) }}">{{ tag }}</a>
<div class="col s12">
<table>
<thead>
<tr>
<th>Tag</th>
<th>Public link</th>
<th>Number of bookmarks</th>
</tr>
</thead>
<tbody>
{% for tag in tags %}
<tr>
<td>
<a href="{{ url_for('tag', userkey=userkey, tag=tag['tag']) }}">{{ tag['tag'] }}</a>
</td>
<td>
{% if tag['publictag'] %}
<a href="{{ url_for('publictag', tagkey=tag['publictag'].tagkey) }}">Public link</a>
{% else %}
-
{% endif %}
</td>
<td>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endfor %}
</div>
{% endblock %}