mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-26 02:54:20 +00:00
43f51813e0
Signed-off-by: Skia <skia@libskia.so>
57 lines
1.8 KiB
Django/Jinja
57 lines
1.8 KiB
Django/Jinja
{% extends "core/base.jinja" %}
|
|
|
|
{% block title %}
|
|
{% trans %}SAS{% endtrans %}
|
|
{% endblock %}
|
|
|
|
{% macro display_album(a) %}
|
|
{% if a.is_moderated %}
|
|
<a href="{{ url("sas:album", album_id=a.id) }}">
|
|
<div class="album">
|
|
<div>
|
|
{% if a.file %}
|
|
<img src="{{ a.get_download_url() }}" alt="{% trans %}preview{% endtrans %}">
|
|
{% elif a.children.filter(is_folder=False, is_moderated=True).exists() %}
|
|
<img src="{{ a.children.filter(is_folder=False).first().as_picture.get_download_thumb_url() }}" alt="{% trans %}preview{% endtrans %}">
|
|
{% else %}
|
|
<img src="{{ static('core/img/sas.jpg') }}" alt="{% trans %}preview{% endtrans %}">
|
|
{% endif %}
|
|
</div>
|
|
{{ a.name }}
|
|
</div>
|
|
</a>
|
|
{% elif user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID) %}
|
|
<div style="display: inline-block; border: solid 1px red; text-align: center">
|
|
<p><a href="{{ url('core:file_moderate', file_id=a.id) }}?next={{ url('sas:moderation') }}">Moderate</a> or <a href="">Delete</a></p>
|
|
<a href="{{ url("sas:album", album_id=a.id) }}">{{ a.name }}</a>
|
|
</div>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% block content %}
|
|
<h3>{% trans %}SAS{% endtrans %}</h3>
|
|
<hr>
|
|
<h4>{% trans %}Latest albums{% endtrans %}</h4>
|
|
<div>
|
|
{% for a in latest %}
|
|
{{ display_album(a) }}
|
|
{% endfor %}
|
|
</div>
|
|
<hr>
|
|
<h4>{% trans %}All categories{% endtrans %}</h4>
|
|
<div>
|
|
{% for a in categories %}
|
|
{{ display_album(a) }}
|
|
{% endfor %}
|
|
</div>
|
|
{% if user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID) %}
|
|
<form action="" method="post" enctype="multipart/form-data">
|
|
{% csrf_token %}
|
|
{{ form.non_field_errors() }}
|
|
<p>{{ form.album_name.errors }}<label for="{{ form.album_name.name }}">{{ form.album_name.label }}</label>
|
|
{{ form.album_name }}</p>
|
|
<p><input type="submit" value="{% trans %}Create{% endtrans %}" /></p>
|
|
</form>
|
|
{% endif %}
|
|
{% endblock %}
|