mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-08 22:17:34 +01:00
Sort meta list, and packages on profile
This commit is contained in:
parent
edd51b86d0
commit
c80ea2c1b1
@ -7,7 +7,7 @@ Meta Packages
|
||||
{% block content %}
|
||||
<ul>
|
||||
{% for meta in mpackages %}
|
||||
<li><a href="{{ url_for('meta_package_page', name=meta.name) }}">{{ meta.name }}</a> ({{ meta.packages | count }} packages)</li>
|
||||
<li><a href="{{ url_for('meta_package_page', name=meta.name) }}">{{ meta.name }}</a> ({{ meta.packages.filter_by(soft_deleted=False, approved=True).all() | count }} packages)</li>
|
||||
{% else %}
|
||||
<li><i>No meta packages found.</i></li>
|
||||
{% endfor %}
|
||||
|
@ -22,13 +22,13 @@ from app.models import *
|
||||
|
||||
@app.route("/metapackages/")
|
||||
def meta_package_list_page():
|
||||
mpackages = MetaPackage.query.order_by(db.desc(MetaPackage.name)).all()
|
||||
return render_template("meta/list.html", mpackages=mpackages)
|
||||
mpackages = MetaPackage.query.order_by(db.asc(MetaPackage.name)).all()
|
||||
return render_template("meta/list.html", mpackages=mpackages)
|
||||
|
||||
@app.route("/metapackages/<name>/")
|
||||
def meta_package_page(name):
|
||||
mpackage = MetaPackage.query.filter_by(name=name).first()
|
||||
if mpackage is None:
|
||||
abort(404)
|
||||
mpackage = MetaPackage.query.filter_by(name=name).first()
|
||||
if mpackage is None:
|
||||
abort(404)
|
||||
|
||||
return render_template("meta/view.html", mpackage=mpackage)
|
||||
return render_template("meta/view.html", mpackage=mpackage)
|
||||
|
@ -27,7 +27,7 @@ from app.utils import rank_required
|
||||
@app.route("/tags/")
|
||||
@rank_required(UserRank.MODERATOR)
|
||||
def tag_list_page():
|
||||
return render_template("tags/list.html", tags=Tag.query.all())
|
||||
return render_template("tags/list.html", tags=Tag.query.order_by(db.asc(Tag.title)).all())
|
||||
|
||||
class TagForm(FlaskForm):
|
||||
title = StringField("Title", [InputRequired(), Length(3,100)])
|
||||
|
@ -54,6 +54,8 @@ def user_profile_page(username):
|
||||
if not current_user.is_authenticated or (user != current_user and not current_user.canAccessTodoList()):
|
||||
packages = packages.filter_by(approved=True)
|
||||
|
||||
packages = packages.order_by(db.asc(Package.title))
|
||||
|
||||
form = None
|
||||
if user.checkPerm(current_user, Permission.CHANGE_DNAME) or \
|
||||
user.checkPerm(current_user, Permission.CHANGE_EMAIL) or \
|
||||
|
Loading…
Reference in New Issue
Block a user