From 00ba39a5a0bae951aaa88cc09a55ed0f0a191189 Mon Sep 17 00:00:00 2001 From: Julien Constant Date: Mon, 13 Mar 2023 10:48:38 +0100 Subject: [PATCH] fix crash when image is not defined --- core/static/user/user_edit.scss | 10 +++++++--- core/templates/core/user_edit.jinja | 22 ++++++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/core/static/user/user_edit.scss b/core/static/user/user_edit.scss index f0101ebc..1b499b36 100644 --- a/core/static/user/user_edit.scss +++ b/core/static/user/user_edit.scss @@ -72,17 +72,21 @@ &-edit { display: flex; flex-direction: column-reverse; - align-items: flex-start; + align-items: center; justify-content: center; width: 100%; - >input { + > a { + margin-bottom: 15px; + } + + > input { font-size: .8em; font-weight: normal; cursor: pointer; } - >p { + > p { margin-bottom: 0; text-align: left !important; min-height: 50px; diff --git a/core/templates/core/user_edit.jinja b/core/templates/core/user_edit.jinja index 045f850f..35295226 100644 --- a/core/templates/core/user_edit.jinja +++ b/core/templates/core/user_edit.jinja @@ -31,9 +31,10 @@

{{ form["profile_pict"].label }}

{{ form["profile_pict"] }} - {%- if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) -%} - {%- trans - -%}Delete{%- endtrans -%} + {%- if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) and form.instance.profile_pict.id -%} + + {%- trans -%}Delete{%- endtrans -%} + {%- endif -%}
@@ -50,9 +51,10 @@

{{ form["avatar_pict"].label }}

{{ form["avatar_pict"] }} - {%- if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) -%} - {%- trans - -%}Delete{%- endtrans -%} + {%- if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) and form.instance.avatar_pict.id -%} + + {%- trans -%}Delete{%- endtrans -%} + {%- endif -%}
@@ -69,10 +71,10 @@

{{ form["scrub_pict"].label }}

{{ form["scrub_pict"] }} - {%- if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) -%} - {%- trans - -%}Delete{%- - endtrans -%} + {%- if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) and form.instance.scrub_pict.id -%} + + {%- trans -%}Delete{%-endtrans -%} + {%- endif -%}