main.jinja 1.7 KB
Newer Older
Skia's avatar
Skia committed
1 2 3 4 5 6 7 8
{% extends "core/base.jinja" %}

{% block title %}
{% trans %}SAS{% endtrans %}
{% endblock %}

{% block content %}
<h3>{% trans %}SAS{% endtrans %}</h3>
Skia's avatar
Skia committed
9
<hr>
Skia's avatar
Skia committed
10
<div>
Skia's avatar
Skia committed
11
    {% for a in root_file.children.filter(is_folder=True).order_by('date') %}
Skia's avatar
Skia committed
12
    {% if a.is_moderated %}
Skia's avatar
Skia committed
13 14 15
    <a href="{{ url("sas:album", album_id=a.id) }}">
    <div class="album">
        <div>
Skia's avatar
Skia committed
16 17 18
        {% if a.file %}
        <img src="{{ a.as_picture.get_download_url() }}" alt="{% trans %}preview{% endtrans %}">
        {% elif a.children.filter(is_folder=False, is_moderated=True).exists() %}
Skia's avatar
Skia committed
19 20 21 22 23 24
        <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 }}
Skia's avatar
Skia committed
25
    </div>
Skia's avatar
Skia committed
26
    </a>
Skia's avatar
Skia committed
27 28 29 30 31 32
    {% elif user.is_in_group(settings.SITH_SAS_ADMIN_GROUP_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 %}
Skia's avatar
Skia committed
33 34
    {% endfor %}
</div>
Skia's avatar
Skia committed
35 36 37 38 39 40 41 42 43
{% if user.is_in_group(settings.SITH_SAS_ADMIN_GROUP_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 %}
Skia's avatar
Skia committed
44
{% endblock %}