diff --git a/app/blueprints/todo/__init__.py b/app/blueprints/todo/__init__.py index 0d64ad34..8e07bb35 100644 --- a/app/blueprints/todo/__init__.py +++ b/app/blueprints/todo/__init__.py @@ -272,3 +272,26 @@ def outdated(): return render_template("todo/outdated.html", current_tab="outdated", outdated_packages=query.all(), sort_by=sort_by, is_mtm_only=is_mtm_only) + + +@bp.route("/todo/screenshots/") +@login_required +def screenshots(): + is_mtm_only = isYes(request.args.get("mtm")) + + query = db.session.query(Package) \ + .filter(~Package.screenshots.any()) \ + .filter(Package.state == PackageState.APPROVED) + + if is_mtm_only: + query = query.filter(Package.repo.ilike("%github.com/minetest-mods/%")) + + sort_by = request.args.get("sort") + if sort_by == "date": + query = query.order_by(db.desc(Package.approved_at)) + else: + sort_by = "score" + query = query.order_by(db.desc(Package.score)) + + return render_template("todo/screenshots.html", current_tab="screenshots", + packages=query.all(), sort_by=sort_by, is_mtm_only=is_mtm_only) diff --git a/app/templates/todo/screenshots.html b/app/templates/todo/screenshots.html new file mode 100644 index 00000000..4444d01f --- /dev/null +++ b/app/templates/todo/screenshots.html @@ -0,0 +1,39 @@ +{% extends "todo/todo_base.html" %} + +{% block title %} + {{ _("Missing Screenshots") }} +{% endblock %} + +{% block content %} +
+
+ {% if is_mtm_only %} + + {{ _("Minetest-Mods org only") }} + + {% else %} + + {{ _("Minetest-Mods org only") }} + + {% endif %} +
+ +
+ + {{ _("Sort by date") }} + + + {{ _("Sort by score") }} + +
+
+

+ {{ _("%(count)d packages", count=packages | count) }} +

+
+ + {% from "macros/packagegridtile.html" import render_pkggrid %} + {{ render_pkggrid(packages, current_user) }} +{% endblock %} diff --git a/app/templates/todo/todo_base.html b/app/templates/todo/todo_base.html index e29e283e..f9b97ee7 100644 --- a/app/templates/todo/todo_base.html +++ b/app/templates/todo/todo_base.html @@ -6,31 +6,37 @@