Metapackages: Split up "provided" into multiple subheadings

This commit is contained in:
rubenwardy 2022-02-02 00:56:56 +00:00
parent 1c9d6ac865
commit ead077fb92
2 changed files with 13 additions and 11 deletions

@ -53,12 +53,11 @@ def view(name):
.filter(Dependency.optional==True, Package.state==PackageState.APPROVED) \ .filter(Dependency.optional==True, Package.state==PackageState.APPROVED) \
.all() .all()
similar_topics = None similar_topics = ForumTopic.query \
if mpackage.packages.filter_by(state=PackageState.APPROVED).count() == 0: .filter_by(name=name) \
similar_topics = ForumTopic.query \ .filter(~ db.exists().where(Package.forums == ForumTopic.topic_id)) \
.filter_by(name=name) \ .order_by(db.asc(ForumTopic.name), db.asc(ForumTopic.title)) \
.order_by(db.asc(ForumTopic.name), db.asc(ForumTopic.title)) \ .all()
.all()
return render_template("metapackages/view.html", mpackage=mpackage, return render_template("metapackages/view.html", mpackage=mpackage,
dependers=dependers, optional_dependers=optional_dependers, dependers=dependers, optional_dependers=optional_dependers,

@ -4,18 +4,21 @@
{{ mpackage.name }} - {{ _("Meta Packages") }} {{ mpackage.name }} - {{ _("Meta Packages") }}
{% endblock %} {% endblock %}
{% from "macros/packagegridtile.html" import render_pkggrid %}
{% block content %} {% block content %}
<h1>{{ _("Meta Package \"%(name)s\"", name=mpackage.name) }}</h1> <h1>{{ _("Meta Package \"%(name)s\"", name=mpackage.name) }}</h1>
<h2>{{ _("Provided By") }}</h2> <h2>{{ _("Provided By") }}</h2>
{% from "macros/packagegridtile.html" import render_pkggrid %} <h3>{{ _("Games") }}</h3>
{{ render_pkggrid(mpackage.packages.filter_by(state="APPROVED").all()) }} {{ render_pkggrid(mpackage.packages.filter_by(type="GAME", state="APPROVED").all()) }}
<h3>{{ _("Mods") }}</h3>
{{ render_pkggrid(mpackage.packages.filter_by(type="MOD", state="APPROVED").all()) }}
{% if similar_topics %} {% if similar_topics %}
<p> <h3>{{ _("Forum Topics") }}</h3>
{{ _("Unfortunately, this isn't on ContentDB yet! Here's some forum topic(s):") }}
</p>
<ul> <ul>
{% for t in similar_topics %} {% for t in similar_topics %}
<li> <li>