From f54bf2b8af854d00abcf0a55cb760774d1aee247 Mon Sep 17 00:00:00 2001 From: Sli Date: Wed, 21 Aug 2024 14:37:02 +0200 Subject: [PATCH] Adjust css --- core/static/user/user_edit.scss | 37 ++++++++++++++++++++--------- core/templates/core/user_edit.jinja | 36 +++++++++++++++------------- 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/core/static/user/user_edit.scss b/core/static/user/user_edit.scss index 08cff0ea..d1ad12d0 100644 --- a/core/static/user/user_edit.scss +++ b/core/static/user/user_edit.scss @@ -81,8 +81,8 @@ > img, > video { width: 100% !important; - object-fit: contain; - height: auto; + object-fit: cover; + height: 100% !important; max-height: 100%; } @@ -98,23 +98,38 @@ &-edit { display: flex; - flex-direction: column-reverse; + flex-direction: column; align-items: center; justify-content: center; width: 100%; - > a { - margin-bottom: 15px; - } + > div { + max-width: 100%; + + > input { + font-weight: normal; + cursor: pointer; + } + + > button { + min-width: 30%; + } + + @media (min-width: 750px) { + height: auto; + align-items: center; + display: inline-flex; + overflow: hidden; + + > input { + font-size: .6em; + } + } - > input { - font-size: .8em; - font-weight: normal; - cursor: pointer; } > p { - margin-bottom: 0; + margin-bottom: 10px; text-align: left !important; min-height: 50px; } diff --git a/core/templates/core/user_edit.jinja b/core/templates/core/user_edit.jinja index 7c114a77..c7b3369e 100644 --- a/core/templates/core/user_edit.jinja +++ b/core/templates/core/user_edit.jinja @@ -12,7 +12,6 @@
{%- trans -%}Profile{%- endtrans -%}
{%- if form[field_name] -%} +
+ {{ form[field_name] }} + {%- if user.is_root and form.instance[field_name] -%} + + {%- endif -%} +

{{ 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 -%} @@ -67,17 +68,19 @@ Alpine.data("camera_{{ field_name }}", () => ({ can_edit_picture: false, + /* Those values are based on the unknwon.jpg file */ + width: 417, + height: 434, + loading: false, is_camera_enabled: false, is_camera_error: false, picture: null, video: null, - img: null, picture_form: null, init() { this.video = this.$refs.video; - this.img = this.$refs.img; this.picture_form = this.$refs.form.getElementsByTagName("input"); if (this.picture_form.length > 0){ this.picture_form = this.picture_form[0]; @@ -106,9 +109,9 @@ .then((stream) => { this.loading = false; this.is_camera_enabled = true; - this.video.width = this.img.width; - this.video.height = this.img.height; this.video.srcObject = stream; + this.video.width = 320; + this.video.height = 240; this.video.play(); }) .catch((err) => { @@ -121,6 +124,12 @@ let canvas = document.createElement("canvas") const context = canvas.getContext("2d"); + /* Create the image */ + canvas.width = this.video.width; + canvas.height = this.video.height; + context.drawImage(this.video, 0, 0, canvas.width, canvas.height); + this.picture = canvas.toDataURL("image/png"); + /* Stop camera */ this.video.pause() this.video.srcObject.getTracks().forEach((track) => { @@ -129,11 +138,6 @@ } }); - canvas.width = this.video.width; - canvas.height = this.video.height; - context.drawImage(this.video, 0, 0, this.video.width, this.video.height); - this.picture = canvas.toDataURL("image/png"); - canvas.toBlob((blob) => { let file = new File( [blob],