mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 14:32:25 +01:00
Add ability to search admin tag list by views
This commit is contained in:
parent
e2a9ea91cf
commit
980e1c9eb1
@ -30,7 +30,14 @@ def tag_list():
|
|||||||
if not Permission.EDIT_TAGS.check(current_user):
|
if not Permission.EDIT_TAGS.check(current_user):
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
return render_template("admin/tags/list.html", tags=Tag.query.order_by(db.asc(Tag.title)).all())
|
query = Tag.query
|
||||||
|
|
||||||
|
if request.args.get("sort") == "views":
|
||||||
|
query = query.order_by(db.desc(Tag.views))
|
||||||
|
else:
|
||||||
|
query = query.order_by(db.asc(Tag.title))
|
||||||
|
|
||||||
|
return render_template("admin/tags/list.html", tags=query.all())
|
||||||
|
|
||||||
class TagForm(FlaskForm):
|
class TagForm(FlaskForm):
|
||||||
title = StringField("Title", [InputRequired(), Length(3,100)])
|
title = StringField("Title", [InputRequired(), Length(3,100)])
|
||||||
|
@ -9,6 +9,12 @@
|
|||||||
|
|
||||||
<h1>{{ _("Tags") }}</h1>
|
<h1>{{ _("Tags") }}</h1>
|
||||||
|
|
||||||
|
<p class="float-right">
|
||||||
|
Sort by:
|
||||||
|
<a href="{{ url_set_query(sort='name') }}">Name</a> |
|
||||||
|
<a href="{{ url_set_query(sort='views') }}">Views</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Also see <a href="/help/package_tags/">Package Tags</a>.
|
Also see <a href="/help/package_tags/">Package Tags</a>.
|
||||||
</p>
|
</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user