mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Add ability to filter by minetest-mods in outdated page
This commit is contained in:
parent
d7647520c8
commit
c6a973f7e1
@ -21,7 +21,7 @@ from sqlalchemy import or_
|
||||
|
||||
from app.models import *
|
||||
from app.querybuilder import QueryBuilder
|
||||
from app.utils import get_int_or_abort, addNotification, addAuditLog
|
||||
from app.utils import get_int_or_abort, addNotification, addAuditLog, isYes
|
||||
from app.tasks.importtasks import makeVCSRelease
|
||||
|
||||
bp = Blueprint("todo", __name__)
|
||||
@ -226,11 +226,16 @@ def apply_all_updates(username):
|
||||
@bp.route("/todo/outdated/")
|
||||
@login_required
|
||||
def outdated():
|
||||
is_mtm_only = isYes(request.args.get("mtm"))
|
||||
|
||||
query = db.session.query(Package).select_from(PackageUpdateConfig) \
|
||||
.filter(PackageUpdateConfig.outdated_at.isnot(None)) \
|
||||
.join(PackageUpdateConfig.package) \
|
||||
.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(PackageUpdateConfig.outdated_at))
|
||||
@ -239,4 +244,4 @@ def outdated():
|
||||
query = query.order_by(db.desc(Package.score))
|
||||
|
||||
return render_template("todo/outdated.html", current_tab="outdated",
|
||||
outdated_packages=query.all(), sort_by=sort_by)
|
||||
outdated_packages=query.all(), sort_by=sort_by, is_mtm_only=is_mtm_only)
|
||||
|
@ -5,15 +5,29 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="btn-group btn-group-sm float-right">
|
||||
<a class="btn btn-secondary {% if sort_by == 'date' %}active{% endif %}"
|
||||
href="{{ url_set_query(sort='date') }}">
|
||||
Sort by date
|
||||
</a>
|
||||
<a class="btn btn-secondary {% if sort_by == 'score' %}active{% endif %}"
|
||||
href="{{ url_set_query(sort='score') }}">
|
||||
Sort by score
|
||||
</a>
|
||||
<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 only
|
||||
</a>
|
||||
{% else %}
|
||||
<a class="btn btn-sm btn-secondary" href="{{ url_set_query(mtm=1) }}">
|
||||
Minetest Mods 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>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user