mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 11:47:28 +01:00
Add link to collections search to package page
This commit is contained in:
parent
e9193aefb8
commit
c782e59531
@ -168,6 +168,10 @@ def view(package):
|
|||||||
Collection.packages.contains(package),
|
Collection.packages.contains(package),
|
||||||
Collection.name == "favorites").count()
|
Collection.name == "favorites").count()
|
||||||
|
|
||||||
|
public_collection_count = Collection.query.filter(
|
||||||
|
Collection.packages.contains(package),
|
||||||
|
Collection.private == False).count()
|
||||||
|
|
||||||
is_favorited = current_user.is_authenticated and \
|
is_favorited = current_user.is_authenticated and \
|
||||||
Collection.query.filter(
|
Collection.query.filter(
|
||||||
Collection.author == current_user,
|
Collection.author == current_user,
|
||||||
@ -177,7 +181,8 @@ def view(package):
|
|||||||
return render_template("packages/view.html",
|
return render_template("packages/view.html",
|
||||||
package=package, releases=releases, packages_uses=packages_uses,
|
package=package, releases=releases, packages_uses=packages_uses,
|
||||||
review_thread=review_thread, threads=threads.all(), validation=validation,
|
review_thread=review_thread, threads=threads.all(), validation=validation,
|
||||||
has_review=has_review, favorites_count=favorites_count, is_favorited=is_favorited)
|
has_review=has_review, favorites_count=favorites_count, is_favorited=is_favorited,
|
||||||
|
public_collection_count=public_collection_count)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/packages/<author>/<name>/shields/<type>/")
|
@bp.route("/packages/<author>/<name>/shields/<type>/")
|
||||||
|
@ -381,8 +381,8 @@
|
|||||||
{{ self.download_btn() }}
|
{{ self.download_btn() }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if current_user.is_authenticated %}
|
<div class="mt-3 mb-3">
|
||||||
<div class="d-flex mt-3 mb-4">
|
<div class="d-flex">
|
||||||
<form method="POST" action="{{ package.get_url('collections.package_toggle_favorite') }}">
|
<form method="POST" action="{{ package.get_url('collections.package_toggle_favorite') }}">
|
||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||||
<button type="submit" class="btn {% if is_favorited %}text-info{% endif %} btn-secondary me-2"
|
<button type="submit" class="btn {% if is_favorited %}text-info{% endif %} btn-secondary me-2"
|
||||||
@ -399,7 +399,16 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% if public_collection_count > 0 %}
|
||||||
|
<p class="text-center mt-1">
|
||||||
|
<a href="{{ url_for('collections.list_all', package=package.get_id()) }}">
|
||||||
|
<small>
|
||||||
|
{{ _("View %(count)d collections", count=public_collection_count) }}
|
||||||
|
</small>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if package.check_perm(current_user, "MAKE_RELEASE") and package.update_config and package.update_config.outdated_at %}
|
{% if package.check_perm(current_user, "MAKE_RELEASE") and package.update_config and package.update_config.outdated_at %}
|
||||||
{% set config = package.update_config %}
|
{% set config = package.update_config %}
|
||||||
|
Loading…
Reference in New Issue
Block a user