mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-10 15:07:35 +01:00
Fix various issues with collections
This commit is contained in:
parent
af4f03d298
commit
2ad25f1aa9
@ -30,6 +30,9 @@ from app.utils import is_package_page, nonempty_or_none, add_audit_log
|
|||||||
bp = Blueprint("collections", __name__)
|
bp = Blueprint("collections", __name__)
|
||||||
|
|
||||||
|
|
||||||
|
regex_invalid_chars = re.compile("[^a-z0-9_]")
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/collections/")
|
@bp.route("/collections/")
|
||||||
@bp.route("/collections/<author>/")
|
@bp.route("/collections/<author>/")
|
||||||
def list_all(author=None):
|
def list_all(author=None):
|
||||||
@ -120,9 +123,6 @@ def create_edit(author=None, name=None):
|
|||||||
collection=collection, form=form)
|
collection=collection, form=form)
|
||||||
|
|
||||||
|
|
||||||
regex_invalid_chars = re.compile("[^a-z_]")
|
|
||||||
|
|
||||||
|
|
||||||
def handle_create_edit(collection: Collection, form: CollectionForm,
|
def handle_create_edit(collection: Collection, form: CollectionForm,
|
||||||
initial_package: typing.Optional[Package], author: User):
|
initial_package: typing.Optional[Package], author: User):
|
||||||
|
|
||||||
|
@ -266,6 +266,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="list-inline-item"><a href="{{ url_for('users.list_all') }}">{{ _("User List") }}</a></li>
|
<li class="list-inline-item"><a href="{{ url_for('users.list_all') }}">{{ _("User List") }}</a></li>
|
||||||
<li class="list-inline-item"><a href="{{ url_for('threads.list_all') }}">{{ _("Threads") }}</a></li>
|
<li class="list-inline-item"><a href="{{ url_for('threads.list_all') }}">{{ _("Threads") }}</a></li>
|
||||||
|
<li class="list-inline-item"><a href="{{ url_for('collections.list_all') }}">{{ _("Collections") }}</a></li>
|
||||||
<li class="list-inline-item"><a href="{{ url_for('donate.donate') }}">{{ _("Support Packages") }}</a></li>
|
<li class="list-inline-item"><a href="{{ url_for('donate.donate') }}">{{ _("Support Packages") }}</a></li>
|
||||||
<li class="list-inline-item"><a href="https://github.com/minetest/contentdb">{{ _("Source Code") }}</a></li>
|
<li class="list-inline-item"><a href="https://github.com/minetest/contentdb">{{ _("Source Code") }}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -33,7 +33,10 @@
|
|||||||
{{ _("%(title)s by %(author)s", title=package.title, author=package.author.display_name) }}
|
{{ _("%(title)s by %(author)s", title=package.title, author=package.author.display_name) }}
|
||||||
</a>
|
</a>
|
||||||
</h5>
|
</h5>
|
||||||
{{ render_field(form.descriptions[loop.index - 1]) }}
|
<p class="text-muted">
|
||||||
|
{{ package.short_desc }}
|
||||||
|
</p>
|
||||||
|
{{ render_field(form.descriptions[loop.index - 1], hint=_("You can replace the description with your own")) }}
|
||||||
{{ form.package_ids[loop.index - 1]() }}
|
{{ form.package_ids[loop.index - 1]() }}
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
@ -8,6 +8,13 @@
|
|||||||
{{ collection.short_description }}
|
{{ collection.short_description }}
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
|
|
||||||
|
{% block headextra %}
|
||||||
|
{% set thumb_url = collection.packages and collection.packages[0].get_thumb_url(3, True) %}
|
||||||
|
{% if thumb_url -%}
|
||||||
|
<meta name="og:image" content="{{ thumb_url }}">
|
||||||
|
{%- endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block author_link -%}
|
{% block author_link -%}
|
||||||
<a href="{{ url_for('users.profile', username=collection.author.username) }}">
|
<a href="{{ url_for('users.profile', username=collection.author.username) }}">
|
||||||
{{ collection.author.display_name }}
|
{{ collection.author.display_name }}
|
||||||
@ -59,6 +66,11 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="grid-2 gap-3">
|
<div class="grid-2 gap-3">
|
||||||
{% for item in collection.items %}
|
{% for item in collection.items %}
|
||||||
|
{% set package_link %}
|
||||||
|
<a href="{{ item.package.get_url('packages.view') }}">
|
||||||
|
{{ item.package.title }}
|
||||||
|
</a>
|
||||||
|
{% endset %}
|
||||||
<div class="">
|
<div class="">
|
||||||
<article class="card">
|
<article class="card">
|
||||||
<div class="embed-responsive embed-responsive-16by9">
|
<div class="embed-responsive embed-responsive-16by9">
|
||||||
@ -66,9 +78,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="mt-0">
|
<h5 class="mt-0">
|
||||||
<a href="{{ item.package.get_url('packages.view') }}">
|
{{ _("%(title)s by %(author)s", title=package_link, author=item.package.author.display_name) }}
|
||||||
{{ item.package.title }}
|
|
||||||
</a>
|
|
||||||
</h5>
|
</h5>
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
{% if item.description %}
|
{% if item.description %}
|
||||||
|
@ -349,7 +349,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if current_user.is_authenticated %}
|
{% if current_user.is_authenticated %}
|
||||||
<div class="d-flex my-3">
|
<div class="d-flex mt-3 mb-4">
|
||||||
<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-danger{% endif %} btn-secondary mr-2" aria-label="{{ _('Favorite') }}">
|
<button type="submit" class="btn {% if is_favorited %}text-danger{% endif %} btn-secondary mr-2" aria-label="{{ _('Favorite') }}">
|
||||||
|
Loading…
Reference in New Issue
Block a user