diff --git a/app/blueprints/todo/__init__.py b/app/blueprints/todo/__init__.py index cb3d5a92..00ae937d 100644 --- a/app/blueprints/todo/__init__.py +++ b/app/blueprints/todo/__init__.py @@ -13,6 +13,7 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import sys from celery import uuid from flask import * @@ -295,3 +296,28 @@ def screenshots(): return render_template("todo/screenshots.html", current_tab="screenshots", packages=query.all(), sort_by=sort_by, is_mtm_only=is_mtm_only) + + +@bp.route("/todo/mtver_support/") +@login_required +def mtver_support(): + is_mtm_only = isYes(request.args.get("mtm")) + + current_stable = MinetestRelease.query.filter(~MinetestRelease.name.like("%-dev")).order_by(db.desc(MinetestRelease.id)).first() + + query = db.session.query(Package) \ + .filter(~Package.releases.any(or_(PackageRelease.max_rel==None, PackageRelease.max_rel == current_stable))) \ + .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/mtver_support.html", current_tab="screenshots", + packages=query.all(), sort_by=sort_by, is_mtm_only=is_mtm_only, current_stable=current_stable) diff --git a/app/templates/macros/todo.html b/app/templates/macros/todo.html index f714ddc8..f98454ff 100644 --- a/app/templates/macros/todo.html +++ b/app/templates/macros/todo.html @@ -1,21 +1,19 @@ -{% macro render_outdated_packages(outdated_packages, current_player, show_config=False) -%} +{% macro render_outdated_packages(outdated_packages, current_user, show_config=False) -%} {% endmacro %} + +{% macro render_mtsupport_packages(packages, current_user, show_config=False) -%} +
+ {% for package in packages %} + +
+
+ + + + {{ package.title }} + +
+ +
+ {% set release = package.getDownloadRelease() %} + {% if release %} + {{ release.min_rel.name }} - {{ release.max_rel.name }} + {% endif %} +
+
+
+ {% else %} +

{{ _("No outdated packages.") }}

+ {% endfor %} +
+{% endmacro %} diff --git a/app/templates/todo/mtver_support.html b/app/templates/todo/mtver_support.html new file mode 100644 index 00000000..f2955fbf --- /dev/null +++ b/app/templates/todo/mtver_support.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block title %} + {{ _("Packages not supporting %(rel)s", rel=current_stable.name) }} +{% endblock %} + +{% block content %} +

{{ self.title() }}

+
+
+ {% if is_mtm_only %} + + {{ _("Minetest-Mods org only") }} + + {% else %} + + {{ _("Minetest-Mods org only") }} + + {% endif %} +
+ + +
+
+ + + {% from "macros/todo.html" import render_mtsupport_packages %} + {{ render_mtsupport_packages(packages, current_user) }} +{% endblock %}