mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-08 08:33:45 +01:00
Add overview stat to languages editor
This commit is contained in:
parent
fe40a7c6d4
commit
ffdd0bbafd
@ -21,7 +21,7 @@ from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, TextAreaField, SubmitField
|
||||
from wtforms.validators import InputRequired, Length, Optional
|
||||
|
||||
from app.models import db, AuditSeverity, UserRank, Language, Package, PackageState
|
||||
from app.models import db, AuditSeverity, UserRank, Language, Package, PackageState, PackageTranslation
|
||||
from app.utils import add_audit_log, rank_required
|
||||
from . import bp
|
||||
|
||||
@ -29,9 +29,11 @@ from . import bp
|
||||
@bp.route("/admin/languages/")
|
||||
@rank_required(UserRank.ADMIN)
|
||||
def language_list():
|
||||
at_least_one_count = db.session.query(PackageTranslation.package_id).group_by(PackageTranslation.package_id).count()
|
||||
total_package_count = Package.query.filter_by(state=PackageState.APPROVED).count()
|
||||
return render_template("admin/languages/list.html",
|
||||
languages=Language.query.all(), total_package_count=total_package_count)
|
||||
languages=Language.query.all(), total_package_count=total_package_count,
|
||||
at_least_one_count=at_least_one_count)
|
||||
|
||||
|
||||
class LanguageForm(FlaskForm):
|
||||
|
@ -8,6 +8,9 @@
|
||||
<a class="btn btn-primary float-end" href="{{ url_for('admin.create_edit_language') }}">New Language</a>
|
||||
|
||||
<h1>{{ _("Languages") }}</h1>
|
||||
<p>
|
||||
{{ at_least_one_count }} packages support at least one language other than English.
|
||||
</p>
|
||||
|
||||
<div class="list-group">
|
||||
<div class="list-group-item">
|
||||
|
Loading…
Reference in New Issue
Block a user