From 0167afe38f4348fd2448e7902b638c6ea6780043 Mon Sep 17 00:00:00 2001 From: Julien Constant Date: Fri, 10 Mar 2023 11:05:09 +0100 Subject: [PATCH] See description - Reworked CSS of user photos tab - Reworked Picture page CSS - A message is now displayed on the user page when he's tagged on a picture in can't access (picture unavailable) --- core/static/sas/album.scss | 6 + core/static/sas/picture.scss | 309 ++++++++++++++++++++++++ core/templates/core/user_pictures.jinja | 41 +++- locale/fr/LC_MESSAGES/django.po | 4 + sas/templates/sas/picture.jinja | 285 ++++++++++++---------- 5 files changed, 506 insertions(+), 139 deletions(-) create mode 100644 core/static/sas/picture.scss diff --git a/core/static/sas/album.scss b/core/static/sas/album.scss index 7b09ee3d..2b176d2d 100644 --- a/core/static/sas/album.scss +++ b/core/static/sas/album.scss @@ -118,6 +118,12 @@ flex-wrap: wrap; gap: 5px; + > div { + background: rgba(0, 0, 0, .5); + cursor: not-allowed; + } + + > div, > a { box-sizing: border-box; position: relative; diff --git a/core/static/sas/picture.scss b/core/static/sas/picture.scss new file mode 100644 index 00000000..f5c895fe --- /dev/null +++ b/core/static/sas/picture.scss @@ -0,0 +1,309 @@ +#content { + padding: 10px !important; +} + +.title { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.container { + display: flex; + flex-direction: row; + gap: 10px; + + @media (max-width: 1000px) { + flex-direction: column; + } +} + +.main { + display: flex; + flex-direction: column; + width: calc(75% - 5px); + gap: 10px; + + @media (max-width: 1000px) { + width: 100%; + } + + > .photo { + box-sizing: border-box; + height: 500px; + display: flex; + justify-content: center; + background-color: #333333; + padding: 5px; + + @media (max-width: 1000px) { + width: 100%; + height: auto; + } + + > img { + height: 100%; + max-width: 100%; + object-fit: contain; + } + } +} + +.subsection { + width: calc(25% - 5px); + + @media (max-width: 1000px) { + width: 100%; + } + + > .navigation { + display: flex; + flex-direction: row; + gap: 10px; + + @media (max-width: 1000px) { + width: 100%; + } + + > #prev, + > #next { + width: calc(50% - 5px); + aspect-ratio: 16/9; + background: #aaa; + + > a { + display: flex; + position: relative; + width: 100%; + height: 100%; + + > div { + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + font-size: 30px; + color: white; + + background-repeat: no-repeat; + background-position: center center; + background-size: cover; + + &::before { + position: absolute; + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + background-color: rgba(0, 0, 0, .3); + } + } + } + } + + > #prev > a > div::before { + content: '←'; + } + > #next > a > div::before { + content: '→'; + } + } + + > .tags { + @media (min-width: 1001px) { + margin-right: 5px; + } + + > ul { + list-style-type: none; + margin: 0; + display: flex; + flex-direction: column; + gap: 5px; + + @media (max-width: 1000px) { + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + gap: 10px; + margin-right: 5px; + } + + > li { + box-sizing: border-box; + display: flex; + flex-direction: row; + align-items: center; + width: 100%; + justify-content: space-between; + + @media (max-width: 1000px) { + max-width: calc(50% - 5px); + } + + > a { + display: flex; + flex-direction: row; + align-items: center; + gap: 10px; + + &.user { + width: 100%; + background-color: #eee; + padding: 5px 10px 5px 5px; + border-radius: 5px; + color: black; + max-width: calc(100% - 40px); + min-height: 30px; + + &:hover { + background-color: #aaa; + } + + > span { + width: 100%; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + } + + &.delete { + margin-left: 10px; + } + + > img { + width: 25px; + max-height: 25px; + object-fit: contain; + border-radius: 50%; + } + } + } + } + + > form { + > p { + box-sizing: border-box; + + > input { + width: 100%; + max-width: 100%; + box-sizing: border-box; + } + } + + > .results_on_deck > div { + position: relative; + display: flex; + align-items: center; + word-break: break-word; + + > span { + position: absolute; + top: 0; + right: 0; + } + } + + > input { + width: 100%; + max-width: 100%; + box-sizing: border-box; + } + } + } +} + +.general { + display: flex; + flex-direction: row; + gap: 20px; + + @media (max-width: 1000px) { + flex-direction: column; + } + + > .infos { + display: flex; + flex-direction: column; + + > div > div { + display: flex; + flex-direction: row; + justify-content: space-between; + + > *:first-child { + min-width: 150px; + + @media (max-width: 1000px) { + min-width: auto; + } + } + } + } + + > .tools { + display: flex; + flex-direction: column; + width: 100%; + + > div { + display: flex; + flex-direction: row; + justify-content: space-between; + + > div { + > a.button { + box-sizing: border-box; + background-color: #f2f2f2; + display: flex; + justify-content: center; + align-items: center; + padding: 10px; + color: black; + border-radius: 5px; + width: 40px; + height: 40px; + + &:hover { + background-color: #aaa; + } + } + + > a.text.danger { + color: red; + + &:hover { + color: darkred; + } + } + + &.buttons { + display: flex; + gap: 5px; + } + } + } + } +} + +.moderation { + box-sizing: border-box; + width: 100%; + border: 2px solid coral; + border-radius: 2px; + padding: 10px; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + + > div:last-child { + display: flex; + gap: 20px; + } +} diff --git a/core/templates/core/user_pictures.jinja b/core/templates/core/user_pictures.jinja index 2d4e26a0..785e7cfc 100644 --- a/core/templates/core/user_pictures.jinja +++ b/core/templates/core/user_pictures.jinja @@ -1,5 +1,10 @@ {% extends "core/base.jinja" %} +{%- block additional_css -%} + + +{%- endblock -%} + {% block title %} {% trans user_name=profile.get_display_name() %}{{ user_name }}'s pictures{% endtrans %} {% endblock %} @@ -8,19 +13,35 @@ {% if can_edit(profile, user) %} {% endif %} -{% for a in albums %} -
+ {% for a in albums %}

{{ a.name }}

-
- {% for picture in pictures[a.id] %} -
- - {{ picture.get_display_name() }} - +
+ {% for p in pictures[a.id] %} + {% if p.can_be_viewed_by(user) %} + +
+ {% if not p.is_moderated %} +
 
+
{% trans %}To be moderated{% endtrans %}
+ {% else %} +
 
+ {% endif %} +
+
+ {% else %} +
+
+
{% trans %}Picture Unavailable{% endtrans %}
+
+
+ {% endif %} + {% endfor %}
+
{% endfor %} -
-{% endfor %} {% endblock %} {% block script %} diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index f8d34a5c..e247dc16 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -3332,6 +3332,10 @@ msgstr "Télécharger toutes mes photos" msgid "Error downloading your pictures" msgstr "Erreur de téléchargement de vos photos" +#: core/templates/core/user_picture.jinja: +msgid "Picture Unavailable" +msgstr "Photo Indisponible" + #: core/templates/core/user_preferences.jinja:4 #: core/templates/core/user_preferences.jinja:8 core/views/user.py:238 msgid "Preferences" diff --git a/sas/templates/sas/picture.jinja b/sas/templates/sas/picture.jinja index 68253ea4..156d7b18 100644 --- a/sas/templates/sas/picture.jinja +++ b/sas/templates/sas/picture.jinja @@ -1,150 +1,177 @@ {% extends "core/base.jinja" %} -{% block head %} -{{ super() }} - +{%- block additional_css -%} + + +{%- endblock -%} -{% if picture.get_previous() %} - -{% endif %} -{% if picture.get_next() %} - -{% endif %} +{% block head %} + {{ super() }} + + {% if picture.get_previous() %} + + {% endif %} + {% if picture.get_next() %} + + {% endif %} {% endblock %} {% block title %} -{% trans %}SAS{% endtrans %} + {% trans %}SAS{% endtrans %} {% endblock %} {% macro print_path(file) %} -{% if file and file.parent %} -{{ print_path(file.parent) }} -{{ file.get_display_name() }} > -{% endif %} + {% if file and file.parent %} + {{ print_path(file.parent) }} + {{ file.get_display_name() }} / + {% endif %} {% endmacro %} {% block content %} -SAS > {{ print_path(picture.parent) }} {{ picture.get_display_name() }} -({{ picture.parent.children.filter(id__lte=picture.id).count() }} / {{ picture.parent.children.count() }}) -

{{ picture.get_display_name() }}

-
-
- - + + SAS / {{ print_path(picture.parent) }} {{ picture.get_display_name() }} + + +
+ +
+

{{ picture.get_display_name() }}

+

{{ picture.parent.children.filter(id__lte=picture.id).count() }} / {{ picture.parent.children.count() }}

-
-
{% trans %}People{% endtrans %}
-
    - {% for r in picture.people.all() %} -
  • - {{ r.user.get_short_name() }} - {% if user == r.user or user.can_edit(picture) %} - {% trans %}Delete{% endtrans %} + + + {% if not picture.is_moderated %} + {% set next = picture.get_next() %} + {% if not next %} + {% set next = url('sas:moderation') %} + {% else %} + {% set next = next.get_absolute_url() + "#pict" %} + {% endif %} + +
    +
    + {% if picture.asked_for_removal %} + {% trans %}Asked for removal{% endtrans %} + {% else %} +   {% endif %} -
  • - {% endfor %} -
-
- {% csrf_token %} - {{ form.as_p() }} -

-
-
-
-
{% trans %}Infos{% endtrans %}
-

{% trans %}Date: {% endtrans %}{{ picture.date|date(DATETIME_FORMAT) }}

-

{% trans %}Owner: {% endtrans %}{{ picture.owner.get_short_name() }}

- {% if picture.moderator %} -

{% trans %}Moderator: {% endtrans %}{{ picture.moderator.get_short_name() }}

- {% endif %} -

{{ picture.parent.children.filter(id__lte=picture.id).count() }} / {{ picture.parent.children.count() }}

-
-
-
{% trans %}Tools{% endtrans %}
-

- {% trans %}HD version{% endtrans %} -

-

- {% trans %}Edit{% endtrans %}
- {% trans %}Rotate left{% endtrans %}
- {% trans %}Rotate right{% endtrans %}
- {% trans %}Ask for removal{% endtrans %}
-

-
-
-{% if picture.is_moderated %} -
-{% else %} -
-{% set next = picture.get_next() %} -{% if not next %} - {% set next = url('sas:moderation') %} -{% else %} - {% set next = next.get_absolute_url() + "#pict" %} -{% endif %} -
- {% if picture.asked_for_removal %} - {% trans %}Asked for removal{% endtrans %} +
+ +
{% endif %} - - {% trans %}Moderate{% endtrans %} | - - {% trans %}Delete{% endtrans %} -
-{% endif %} - {% if picture.is_vertical %} - {{ picture.get_display_name() }} - {% else %} - {{ picture.get_display_name() }} - {% endif %} -
+ +
+
+ +
+ {{ picture.get_display_name() }} +
+ +
+
+
{% trans %}Infos{% endtrans %}
+
+
+ {% trans %}Date: {% endtrans %} + {{ picture.date|date(DATETIME_FORMAT) }} +
+
+ {% trans %}Owner: {% endtrans %} + {{ picture.owner.get_short_name() }} +
+ + {% if picture.moderator %} +
+ {% trans %}Moderator: {% endtrans %} + {{ picture.moderator.get_short_name() }} +
+ {% endif %} +
+
+ +
+
{% trans %}Tools{% endtrans %}
+ +
+
+
+ +
+ + +
+
{% trans %}People{% endtrans %}
+
+ {% csrf_token %} + {{ form.as_p() }} + +
+ +
+
+
{% endblock %} {% block script %} -{{ super() }} - + {% endblock %}