Add list of similar packages in details page
This commit is contained in:
parent
d2bda0fded
commit
aad4fd2a70
|
@ -258,4 +258,27 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if similar_topics %}
|
||||||
|
<h3>Similar Forum Topics</h3>
|
||||||
|
{% if not package.approved and package.type == package.type.MOD %}
|
||||||
|
<div class="box box_grey alert alert-warning">
|
||||||
|
Please make sure that this package has the right to
|
||||||
|
the name '{{ package.name }}'.
|
||||||
|
See the
|
||||||
|
<a href="/policy_and_guidance/">Inclusion Policy</a>
|
||||||
|
for more info.
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<ul>
|
||||||
|
{% for t in similar_topics %}
|
||||||
|
<li>
|
||||||
|
[{{ t.getType().value }}]
|
||||||
|
<a href="https://forum.minetest.net/viewtopic.php?t={{ t.topic_id }}">
|
||||||
|
{{ t.title }} by {{ t.author.display_name }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -96,11 +96,22 @@ def package_page(package):
|
||||||
.order_by(db.asc(Package.title)) \
|
.order_by(db.asc(Package.title)) \
|
||||||
.all()
|
.all()
|
||||||
|
|
||||||
|
show_similar_topics = current_user == package.author or \
|
||||||
|
package.checkPerm(current_user, Permission.APPROVE_NEW)
|
||||||
|
|
||||||
|
similar_topics = None if not show_similar_topics else \
|
||||||
|
KrockForumTopic.query \
|
||||||
|
.filter_by(name=package.name) \
|
||||||
|
.filter(KrockForumTopic.topic_id != package.forums) \
|
||||||
|
.filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \
|
||||||
|
.order_by(db.asc(KrockForumTopic.name), db.asc(KrockForumTopic.title)) \
|
||||||
|
.all()
|
||||||
|
|
||||||
releases = getReleases(package)
|
releases = getReleases(package)
|
||||||
requests = [r for r in package.requests if r.status == 0]
|
requests = [r for r in package.requests if r.status == 0]
|
||||||
return render_template("packages/view.html", \
|
return render_template("packages/view.html", \
|
||||||
package=package, releases=releases, requests=requests, \
|
package=package, releases=releases, requests=requests, \
|
||||||
alternatives=alternatives)
|
alternatives=alternatives, similar_topics=similar_topics)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/packages/<author>/<name>/download/")
|
@app.route("/packages/<author>/<name>/download/")
|
||||||
|
|
Loading…
Reference in New Issue