Add missing screenshots page to editor console

This commit is contained in:
rubenwardy 2022-08-09 13:48:49 +01:00
parent 9b7f1e6e88
commit 0b92d43871
3 changed files with 75 additions and 7 deletions

@ -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)

@ -0,0 +1,39 @@
{% extends "todo/todo_base.html" %}
{% block title %}
{{ _("Missing Screenshots") }}
{% endblock %}
{% block content %}
<div class="btn-toolbar float-right">
<div class="btn-group btn-group-sm mr-2">
{% if is_mtm_only %}
<a class="btn btn-sm btn-primary active" href="{{ url_set_query(mtm=0) }}">
{{ _("Minetest-Mods org only") }}
</a>
{% else %}
<a class="btn btn-sm btn-secondary" href="{{ url_set_query(mtm=1) }}">
{{ _("Minetest-Mods org only") }}
</a>
{% endif %}
</div>
<div class="btn-group btn-group-sm">
<a class="btn {% if sort_by == 'date' %}btn-primary active{% else %}btn-secondary{% endif %}"
href="{{ url_set_query(sort='date') }}">
{{ _("Sort by date") }}
</a>
<a class="btn {% if sort_by == 'score' %}btn-primary active{% else %}btn-secondary{% endif %}"
href="{{ url_set_query(sort='score') }}">
{{ _("Sort by score") }}
</a>
</div>
</div>
<p class="text-muted my-0">
{{ _("%(count)d packages", count=packages | count) }}
</p>
<div class="clearfix mb-3"></div>
{% from "macros/packagegridtile.html" import render_pkggrid %}
{{ render_pkggrid(packages, current_user) }}
{% endblock %}

@ -6,31 +6,37 @@
<div class="container">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link {% if current_tab == "user" %}active{% endif %}"
<a class="nav-link {% if current_tab == 'user' %}active{% endif %}"
href="{{ url_for('todo.view_user', username=current_user.username) }}">
{{ _("%(username)s's to do list", username=current_user.display_name) }}
{{ _("Your to do list") }}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if current_tab == "editor" %}active{% endif %}"
<a class="nav-link {% if current_tab == 'editor' %}active{% endif %}"
href="{{ url_for('todo.view_editor') }}">
{{ _("Editor Work Queue") }}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if current_tab == "outdated" %}active{% endif %}"
<a class="nav-link {% if current_tab == 'outdated' %}active{% endif %}"
href="{{ url_for('todo.outdated') }}">
{{ _("All Outdated Packages") }}
{{ _("Outdated Packages") }}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if current_tab == "tags" %}active{% endif %}"
<a class="nav-link {% if current_tab == 'tags' %}active{% endif %}"
href="{{ url_for('todo.tags') }}">
{{ _("Package Tags") }}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if current_tab == "topics" %}active{% endif %}"
<a class="nav-link {% if current_tab == 'screenshots' %}active{% endif %}"
href="{{ url_for('todo.screenshots') }}">
{{ _("Missing Screenshots") }}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if current_tab == 'topics' %}active{% endif %}"
href="{{ url_for('todo.topics') }}">
{{ _("Forum Topics") }}
</a>