contentdb/app/templates/collections/view.html

107 lines
3.2 KiB
HTML
Raw Normal View History

2023-08-14 22:48:50 +02:00
{% extends "base.html" %}
{% block title %}
{{ collection.title }}
{% endblock %}
{% block description -%}
{{ collection.short_description }}
{%- endblock %}
2023-08-15 21:39:32 +02:00
{% 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 %}
2023-08-14 22:48:50 +02:00
{% block author_link -%}
<a href="{{ url_for('users.profile', username=collection.author.username) }}">
{{ collection.author.display_name }}
</a>
{%- endblock %}
{% block content %}
2023-08-22 20:58:43 +02:00
<div class="float-end">
2023-08-14 22:48:50 +02:00
<a class="btn btn-secondary" href="{{ url_for('collections.list_all', author=collection.author.username) }}">
{{ _("%(author)s's collections", author=collection.author.display_name) }}
</a>
{% if current_user.is_authenticated %}
2023-08-22 20:58:43 +02:00
<form method="POST" action="{{ collection.get_url('collections.clone') }}" class="d-inline-block ms-2">
2023-08-14 22:48:50 +02:00
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<button type="submit" class="btn btn-secondary">
{{ _("Make a copy") }}
</button>
</form>
{% endif %}
{% if collection.check_perm(current_user, "EDIT_COLLECTION") %}
2023-08-22 20:58:43 +02:00
<a class="btn btn-danger ms-2" href="{{ collection.get_url('collections.delete') }}">
2023-08-14 23:17:29 +02:00
{{ _("Delete") }}
</a>
2023-08-22 20:58:43 +02:00
<a class="btn btn-primary ms-2" href="{{ collection.get_url('collections.create_edit') }}">
2023-08-14 22:48:50 +02:00
{{ _("Edit") }}
</a>
{% endif %}
</div>
<h1>{{ self.title() }}</h1>
<p class="text-muted">
{% if collection.private %}
2023-08-22 20:58:43 +02:00
<span class="badge bg-secondary me-1">
<i class="fas fa-lock me-1" style="color:#ffac33;"></i>
2023-08-14 22:48:50 +02:00
{{ _("Private") }}
</span>
{% endif %}
{{ _("A collection by %(author)s", author=self.author_link()) }}
</p>
<p class="lead mb-5">
2023-08-14 22:48:50 +02:00
{{ collection.short_description }}
</p>
2023-08-19 03:43:38 +02:00
{% if collection.long_description %}
<div class="markdown mb-5">
{{ collection.long_description | markdown }}
</div>
{% endif %}
2023-08-14 22:48:50 +02:00
<section class="mt-5">
2023-08-22 20:58:43 +02:00
<h2 class="visually-hidden">{{ _("Packages") }}</h2>
{% if not items %}
2023-08-14 22:48:50 +02:00
<p class="text-muted">
{{ _("To add a package, go to the package's page and click 'Add to collection'") }}
</p>
{% endif %}
<div class="grid-2 gap-3">
{% for item in items %}
2023-08-15 21:39:32 +02:00
{% set package_link %}
<a href="{{ item.package.get_url('packages.view') }}">
{{ item.package.title }}
</a>
{% endset %}
<div>
2023-08-14 22:48:50 +02:00
<article class="card">
2023-08-22 20:58:43 +02:00
<div class="ratio ratio-16x9">
<img class="card-img-top" src="{{ item.package.get_thumb_or_placeholder(4) }}" alt="{{ item.package.title }} screenshot">
2023-08-14 22:48:50 +02:00
</div>
<div class="card-body">
{% if item.package.state.name != "APPROVED" %}
2023-08-22 20:58:43 +02:00
<span class="badge bg-warning float-end">
{{ item.package.state.value }}
</span>
{% endif %}
2023-08-14 22:48:50 +02:00
<h5 class="mt-0">
2023-08-15 21:39:32 +02:00
{{ _("%(title)s by %(author)s", title=package_link, author=item.package.author.display_name) }}
2023-08-14 22:48:50 +02:00
</h5>
<p class="card-text">
{% if item.description %}
{{ item.description }}
{% else %}
{{ item.description or item.package.short_desc }}
{% endif %}
</p>
</div>
</article>
</div>
{% endfor %}
</div>
</section>
{% endblock %}