See description

- Made paste button disabled if the clipboard is empty
- Rework main page of the SAS, thus commented block to manage albums as there is currently no possibility to delete them from this page
This commit is contained in:
Julien Constant 2023-03-08 02:04:18 +01:00
parent 238d41b84c
commit f8903cbdca
No known key found for this signature in database
GPG Key ID: 816E7C070117E5B7
3 changed files with 106 additions and 52 deletions

View File

@ -27,6 +27,11 @@
&:hover {
background-color: #d4d4d4;
}
&:disabled {
background-color: #f2f2f2;
color: #d4d4d4;
}
}
}
@ -144,6 +149,8 @@
padding: 0;
box-shadow: none;
border: 1px solid rgba(0, 0, 0, .3);
@media (max-width: 500px) {
width: 100%;
}
@ -162,7 +169,7 @@
color: white;
&:hover {
background: rgba(0, 0, 0, .7);
background: rgba(0, 0, 0, .5);
}
}
@ -192,8 +199,8 @@
}
> .album > div {
background: rgba(0, 0, 0, .3);
background: linear-gradient(0deg, rgba(0, 0, 0, .7) 0%, rgba(0, 0, 0, 0) 100%);
background: rgba(0, 0, 0, .5);
background: linear-gradient(0deg, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, 0) 100%);
text-align: left;
word-break: break-word;
}

View File

@ -37,7 +37,7 @@
<a href="{{ url('sas:album_edit', album_id=album.id) }}">{% trans %}Edit{% endtrans %}</a>
<input name="delete" type="submit" value="{% trans %}Delete{% endtrans %}">
<input name="cut" type="submit" value="{% trans %}Cut{% endtrans %}">
<input name="paste" type="submit" value="{% trans %}Paste{% endtrans %}">
<input {% if not clipboard %}disabled{% endif %} name="paste" type="submit" value="{% trans %}Paste{% endtrans %}">
</div>
</div>
@ -112,7 +112,7 @@
</form>
{% endif %}
{% if edit_mode %}
{% if user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID) %}
<form class="add-files" id="upload_form" action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
<div class="inputs">

View File

@ -1,56 +1,103 @@
{% extends "core/base.jinja" %}
{%- block additional_css -%}
<link rel="stylesheet" href="{{ scss('core/override.scss') }}">
<link rel="stylesheet" href="{{ scss('sas/album.scss') }}">
{%- endblock -%}
{% block title %}
{% trans %}SAS{% endtrans %}
{% 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>
{% set edit_mode = user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID) %}
{% macro display_album(a, checkbox) %}
<a href="{{ url('sas:album', album_id=a.id) }}">
{% if a.file %}
<img src="{{ a.get_download_url() }}" alt="{% trans %}preview{% endtrans %}">
{% set img = a.get_download_url() %}
{% 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 %}">
{% set img = a.children.filter(is_folder=False).first().as_picture.get_download_thumb_url() %}
{% else %}
<img src="{{ static('core/img/sas.jpg') }}" alt="{% trans %}preview{% endtrans %}">
{% set img = static('core/img/sas.jpg') %}
{% endif %}
</div>
<div
class="album"
style="background-image: url('{{ img }}');"
>
<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 %}
</div>
</div>
{# {% if edit_mode and checkbox %}
<input type="checkbox" name="file_list" value="{{ a.id }}">
{% endif %} #}
</a>
{% endmacro %}
{% block content %}
<h3>{% trans %}SAS{% endtrans %}</h3>
<hr>
<h4>{% trans %}Latest albums{% endtrans %}</h4>
<div>
<h3>{% trans %}SAS{% endtrans %}</h3>
<br>
<h4>{% trans %}Latest albums{% endtrans %}</h4>
<div class="albums">
{% 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">
</div>
<br>
{% if edit_mode %}
<form action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
<div class="navbar">
<h4>{% trans %}All categories{% endtrans %}</h4>
{# <div class="toolbar">
<input name="delete" type="submit" value="{% trans %}Delete{% endtrans %}">
</div> #}
</div>
{% if clipboard %}
<div class="clipboard">
{% trans %}Clipboard: {% endtrans %}
<ul>
{% for f in clipboard %}
<li>{{ f.get_full_path() }}</li>
{% endfor %}
</ul>
<input name="clear" type="submit" value="{% trans %}Clear clipboard{% endtrans %}">
</div>
{% endif %}
{% else %}
<h4>{% trans %}All categories{% endtrans %}</h4>
{% endif %}
<div class="albums">
{% for a in categories %}
{{ display_album(a, true) }}
{% endfor %}
</div>
{% if edit_mode %}
</form>
<br>
<form class="add-files" action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
<div class="inputs">
<div>
<label for="{{ form.album_name.name }}">{{ form.album_name.label }}</label>
{{ form.album_name }}
</div>
<input type="submit" value="{% trans %}Create{% endtrans %}" />
</div>
{{ 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 %}
{{ form.album_name.errors }}
</form>
{% endif %}
{% endblock %}