2024-08-08 17:51:33 +02:00
|
|
|
{% macro display_album(a, edit_mode) %}
|
|
|
|
<a href="{{ url('sas:album', album_id=a.id) }}">
|
|
|
|
{% if a.file %}
|
|
|
|
{% set img = a.get_download_url() %}
|
2025-02-19 00:12:30 +01:00
|
|
|
{% set src = a.name %}
|
2024-08-08 17:51:33 +02:00
|
|
|
{% elif a.children.filter(is_folder=False, is_moderated=True).exists() %}
|
2025-02-19 00:12:30 +01:00
|
|
|
{% set picture = a.children.filter(is_folder=False).first().as_picture %}
|
|
|
|
{% set img = picture.get_download_thumb_url() %}
|
|
|
|
{% set src = picture.name %}
|
2024-08-08 17:51:33 +02:00
|
|
|
{% else %}
|
|
|
|
{% set img = static('core/img/sas.jpg') %}
|
2025-02-19 00:12:30 +01:00
|
|
|
{% set src = "sas.jpg" %}
|
2024-08-08 17:51:33 +02:00
|
|
|
{% endif %}
|
|
|
|
<div
|
|
|
|
class="album{% if not a.is_moderated %} not_moderated{% endif %}"
|
|
|
|
>
|
2025-02-19 00:12:30 +01:00
|
|
|
<img src="{{ img }}" alt="{{ src }}" loading="lazy" />
|
2024-08-08 17:51:33 +02:00
|
|
|
{% if not a.is_moderated %}
|
|
|
|
<div class="overlay"> </div>
|
|
|
|
<div class="text">{% trans %}To be moderated{% endtrans %}</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="text">{{ a.name }}</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% if edit_mode %}
|
|
|
|
<input type="checkbox" name="file_list" value="{{ a.id }}">
|
|
|
|
{% endif %}
|
|
|
|
</a>
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro print_path(file) %}
|
|
|
|
{% if file and file.parent %}
|
|
|
|
{{ print_path(file.parent) }}
|
|
|
|
<a href="{{ url('sas:album', album_id=file.id) }}">{{ file.get_display_name() }}</a> /
|
|
|
|
{% endif %}
|
2025-02-20 18:13:40 +01:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{# Helper macro to create a download button for a
|
|
|
|
record of albums with alpine
|
|
|
|
|
|
|
|
This needs to be used inside an alpine environment.
|
|
|
|
Downloaded pictures will be `pictures` from the
|
|
|
|
parent data store.
|
|
|
|
|
|
|
|
Note:
|
|
|
|
This requires importing `bundled/sas/pictures-download-index.ts`
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
name (str): name displayed on the button
|
|
|
|
#}
|
|
|
|
{% macro download_button(name) %}
|
|
|
|
<div x-data="pictures_download">
|
|
|
|
<div x-show="pictures.length > 0" x-cloak>
|
|
|
|
<button
|
|
|
|
:disabled="isDownloading"
|
2025-02-20 18:51:08 +01:00
|
|
|
class="btn btn-blue {% if name == "" %}btn-no-text{% endif %}"
|
2025-02-20 18:13:40 +01:00
|
|
|
@click="downloadZip()"
|
|
|
|
>
|
|
|
|
<i class="fa fa-download"></i>{{ name }}
|
|
|
|
</button>
|
|
|
|
<progress x-ref="progress" x-show="isDownloading"></progress>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|