From e7d04d9817d4201c7292915c763b7620e485fffd Mon Sep 17 00:00:00 2001
From: Sli
Date: Wed, 21 Aug 2024 11:44:11 +0200
Subject: [PATCH] Unify user profile display with a nice macro and handle
camera errors
---
core/static/core/style.scss | 6 +
core/static/user/user_edit.scss | 11 +-
core/templates/core/user_edit.jinja | 325 +++++++++++++---------------
3 files changed, 172 insertions(+), 170 deletions(-)
diff --git a/core/static/core/style.scss b/core/static/core/style.scss
index b08be5fb..01ab8787 100644
--- a/core/static/core/style.scss
+++ b/core/static/core/style.scss
@@ -260,6 +260,12 @@ a:not(.button) {
}
}
+ &.btn-red {
+ background-color: #fc8181;
+ color: black;
+ border: #fc8181 1px solid;
+ }
+
i {
margin-right: 4px;
}
diff --git a/core/static/user/user_edit.scss b/core/static/user/user_edit.scss
index a0dcf559..08cff0ea 100644
--- a/core/static/user/user_edit.scss
+++ b/core/static/user/user_edit.scss
@@ -63,6 +63,11 @@
padding: 10px 10px 0;
}
+ .camera-error {
+ background-color: red;
+ min-width: 100%;
+ }
+
&-display {
display: flex;
flex-direction: column;
@@ -74,13 +79,17 @@
height: auto;
}
- >img {
+ > img, > video {
width: 100% !important;
object-fit: contain;
height: auto;
max-height: 100%;
}
+ > i {
+ font-size: 32px;
+ }
+
>p {
text-align: left !important;
width: 100% !important;
diff --git a/core/templates/core/user_edit.jinja b/core/templates/core/user_edit.jinja
index 9ae0c195..7c114a77 100644
--- a/core/templates/core/user_edit.jinja
+++ b/core/templates/core/user_edit.jinja
@@ -8,6 +8,155 @@
{%- endblock -%}
+{% macro profile_picture(field_name) %}
+
+
+
+
+
+
+
+
+
+
+
+ {%- if form[field_name] -%}
+
+ {{ form[field_name].label }}
+
+ {{ form[field_name] }}
+ {%- if user.is_root and form.instance[field_name] -%}
+
+ {%- endif -%}
+ {%- else -%}
+
{% trans %}To edit your profile picture, ask a member of the AE{% endtrans %}
+ {%- endif -%}
+
+
+
+{% endmacro %}
+
{%- block content -%}
{%- trans -%}Edit user profile{%- endtrans -%}
-
-
{%- endblock -%}
-
-{%- if not form.instance.profile_pict -%}
- {%- block script -%}
- {%- endblock -%}
-{%- endif -%}