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

Total amount of tags, number of bookmarks per tag

This commit is contained in:
2016-08-13 15:35:36 +02:00
parent 78bed962d0
commit 72ad3c0d04
2 changed files with 15 additions and 2 deletions

View File

@@ -422,9 +422,11 @@ def tags(userkey):
publictag = PublicTag.get(PublicTag.userkey == userkey, PublicTag.tag == tag) publictag = PublicTag.get(PublicTag.userkey == userkey, PublicTag.tag == tag)
except PublicTag.DoesNotExist: except PublicTag.DoesNotExist:
publictag = None publictag = None
total = 'n/a' # TODO: count number of bookmarks with this tag
total = Bookmark.select().where(Bookmark.userkey == userkey, Bookmark.tags.contains(tag), Bookmark.status == Bookmark.VISIBLE).count()
alltags.append({'tag': tag, 'publictag': publictag, 'total': total}) alltags.append({'tag': tag, 'publictag': publictag, 'total': total})
return render_template('tags.html', tags=alltags, userkey=userkey) total = len(alltags)
return render_template('tags.html', tags=alltags, total=total, userkey=userkey)
@app.route('/<userkey>/tag/<tag>') @app.route('/<userkey>/tag/<tag>')

View File

@@ -14,6 +14,16 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th>
All
</th>
<th>
-
<th>
{{ total }}
</th>
</tr>
{% for tag in tags %} {% for tag in tags %}
<tr> <tr>
<td> <td>
@@ -27,6 +37,7 @@
{% endif %} {% endif %}
</td> </td>
<td> <td>
{{ tag['total'] }}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}