From 2a86b845da951ea479960b1b22c9d79e63b6d96d Mon Sep 17 00:00:00 2001 From: imperosol Date: Mon, 14 Sep 2026 11:23:03 +0200 Subject: [PATCH] style: improve ue comment form appearance --- core/static/core/accordion.scss | 1 + pedagogy/static/pedagogy/css/pedagogy.scss | 63 ++++++++----------- .../pedagogy/fragments/ue_comment_form.jinja | 53 +++++++--------- .../pedagogy/fragments/ue_detail/form.jinja | 10 --- .../fragments/ue_detail/ue_detail.jinja | 11 +++- pedagogy/templates/pedagogy/ue_detail.jinja | 10 ++- 6 files changed, 69 insertions(+), 79 deletions(-) delete mode 100644 pedagogy/templates/pedagogy/fragments/ue_detail/form.jinja diff --git a/core/static/core/accordion.scss b/core/static/core/accordion.scss index 23bb2fa6..8ea5f4d3 100644 --- a/core/static/core/accordion.scss +++ b/core/static/core/accordion.scss @@ -42,6 +42,7 @@ details.accordion>.accordion-content { background: #ffffff; color: #333333; padding: 1em 2.2em; + margin-top: 0; border: 1px solid #dddddd; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; diff --git a/pedagogy/static/pedagogy/css/pedagogy.scss b/pedagogy/static/pedagogy/css/pedagogy.scss index 20703a5c..04a0d8fc 100644 --- a/pedagogy/static/pedagogy/css/pedagogy.scss +++ b/pedagogy/static/pedagogy/css/pedagogy.scss @@ -108,36 +108,35 @@ $pedagogy-white-text: #f0f0f0; } } - #leave_comment_not_allowed { + .leave-comment-not-allowed { p { text-align: center; color: red; } } - #leave_comment { - .leave-comment-grid-container { - display: grid; - grid-template-columns: 270px auto; - grid-template-rows: 100%; - grid-template-areas: "stars comment"; + .leave-comment { + .comment-form-content { + display: flex; + gap: 2em; @media screen and (max-width: $large-devices) { - grid-template-columns: 100%; - grid-template-rows: auto auto; - grid-template-areas: - "stars" - "comment"; + gap: 1em; + flex-direction: column; } - } - .form-stars { - grid-area: stars; + flex: 0; + min-width: 250px; + display: flex; + align-content: flex-start; + justify-content: center; + flex-wrap: wrap; + gap: 1rem 2em; + height: unset; } - .form-comment { - grid-area: comment; + flex: 2; } .ui-accordion-header-icon { @@ -145,8 +144,17 @@ $pedagogy-white-text: #f0f0f0; margin-right: 10px; } - .input-stars { - margin-top: 20px; + input[type="submit"] { + display: block; + margin-left: auto; + } + + summary { + background: $pedagogy-orange; + color: $pedagogy-white-text; + @media screen and (min-width: $large-devices) { + clip-path: polygon(0 0%, 0 100%, 30% 100%, 33% 0); + } } } @@ -370,23 +378,6 @@ $pedagogy-white-text: #f0f0f0; } } -details.accordion summary { - - background: $pedagogy-orange !important; - color: $pedagogy-white-text !important; - clip-path: polygon(0 0%, 0 100%, 30% 100%, 33% 0); - - @media screen and (max-width: $large-devices) { - clip-path: none; - } -} - -details.accordion>.accordion-content { - background-color: $white-color; - border-color: $pedagogy-orange; - border-right: none; -} - .buttons { display: flex; justify-content: flex-end; diff --git a/pedagogy/templates/pedagogy/fragments/ue_comment_form.jinja b/pedagogy/templates/pedagogy/fragments/ue_comment_form.jinja index 7ec115be..529dd8b9 100644 --- a/pedagogy/templates/pedagogy/fragments/ue_comment_form.jinja +++ b/pedagogy/templates/pedagogy/fragments/ue_comment_form.jinja @@ -11,44 +11,39 @@ hx-disabled-elt="find input[type='submit']" > {% csrf_token %} -
+ {{ form.non_field_errors() }} + {{ form.author.errors }} + {{ form.ue.errors }} + + {{ form.author }} + {{ form.ue }} +
- {{ form.non_field_errors() }} - {{ form.author.errors }} - {{ form.ue.errors }} - - {{ form.author }} - {{ form.ue }} - -
- +
+ {{ form.grade_global.label }} : {{ form.grade_global.errors }} {{ form.grade_global }} -
- -
- + +
+ {{ form.grade_utility.label }} : {{ form.grade_utility.errors }} {{ form.grade_utility }} -
- -
- + +
+ {{ form.grade_interest.label }} : {{ form.grade_interest.errors }} {{ form.grade_interest }} -
- -
- + +
+ {{ form.grade_teaching.label }} : {{ form.grade_teaching.errors }} {{ form.grade_teaching }} -
- -
- + +
+ {{ form.grade_work_load.label }} : {{ form.grade_work_load.errors }} {{ form.grade_work_load }} -
+
@@ -56,9 +51,7 @@ {{ form.comment }}
-
- -
+

{% if form.is_creation %} diff --git a/pedagogy/templates/pedagogy/fragments/ue_detail/form.jinja b/pedagogy/templates/pedagogy/fragments/ue_detail/form.jinja deleted file mode 100644 index 7414f4b5..00000000 --- a/pedagogy/templates/pedagogy/fragments/ue_detail/form.jinja +++ /dev/null @@ -1,10 +0,0 @@ -{% if object.has_user_already_commented(user) %} -
-

{% trans %}You already posted a comment on this UE. If you want to comment again, please modify or delete your previous comment.{% endtrans %}

-
-
-{% endif %} - -{% if not object.has_user_already_commented(user) and user.has_perm("pedagogy.add_uecomment") %} - {{ add_comment_form }} -{% endif %} diff --git a/pedagogy/templates/pedagogy/fragments/ue_detail/ue_detail.jinja b/pedagogy/templates/pedagogy/fragments/ue_detail/ue_detail.jinja index d1477f39..5f82c6d6 100644 --- a/pedagogy/templates/pedagogy/fragments/ue_detail/ue_detail.jinja +++ b/pedagogy/templates/pedagogy/fragments/ue_detail/ue_detail.jinja @@ -1,9 +1,18 @@ +{# A few hx-partials for swapping a few parts of the main ue_detail.jinja #} + {% include "pedagogy/fragments/ue_detail/grade.jinja" %} - {% include "pedagogy/fragments/ue_detail/form.jinja" %} + {% if object.has_user_already_commented(user) %} +
+

{% trans %}You already posted a comment on this UE. If you want to comment again, please modify or delete your previous comment.{% endtrans %}

+
+
+ {% elif user.has_perm("pedagogy.add_uecomment") %} + {{ add_comment_form }} + {% endif %}
diff --git a/pedagogy/templates/pedagogy/ue_detail.jinja b/pedagogy/templates/pedagogy/ue_detail.jinja index 08c1ac3d..b1aeea3c 100644 --- a/pedagogy/templates/pedagogy/ue_detail.jinja +++ b/pedagogy/templates/pedagogy/ue_detail.jinja @@ -73,11 +73,17 @@
-
- {% include "pedagogy/fragments/ue_detail/form.jinja" %} + {% if object.has_user_already_commented(user) %} +
+

{% trans %}You already posted a comment on this UE. If you want to comment again, please modify or delete your previous comment.{% endtrans %}

+
+
+ {% elif user.has_perm("pedagogy.add_uecomment") %} + {{ add_comment_form }} + {% endif %}