style: improve ue comment form appearance

This commit is contained in:
imperosol
2026-09-14 11:51:19 +02:00
parent e2f32d1fe5
commit 2a86b845da
6 changed files with 69 additions and 79 deletions
+1
View File
@@ -42,6 +42,7 @@ details.accordion>.accordion-content {
background: #ffffff; background: #ffffff;
color: #333333; color: #333333;
padding: 1em 2.2em; padding: 1em 2.2em;
margin-top: 0;
border: 1px solid #dddddd; border: 1px solid #dddddd;
border-bottom-right-radius: 3px; border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px; border-bottom-left-radius: 3px;
+27 -36
View File
@@ -108,36 +108,35 @@ $pedagogy-white-text: #f0f0f0;
} }
} }
#leave_comment_not_allowed { .leave-comment-not-allowed {
p { p {
text-align: center; text-align: center;
color: red; color: red;
} }
} }
#leave_comment { .leave-comment {
.leave-comment-grid-container { .comment-form-content {
display: grid; display: flex;
grid-template-columns: 270px auto; gap: 2em;
grid-template-rows: 100%;
grid-template-areas: "stars comment";
@media screen and (max-width: $large-devices) { @media screen and (max-width: $large-devices) {
grid-template-columns: 100%; gap: 1em;
grid-template-rows: auto auto; flex-direction: column;
grid-template-areas:
"stars"
"comment";
} }
} }
.form-stars { .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 { .form-comment {
grid-area: comment; flex: 2;
} }
.ui-accordion-header-icon { .ui-accordion-header-icon {
@@ -145,8 +144,17 @@ $pedagogy-white-text: #f0f0f0;
margin-right: 10px; margin-right: 10px;
} }
.input-stars { input[type="submit"] {
margin-top: 20px; 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 { .buttons {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
@@ -11,44 +11,39 @@
hx-disabled-elt="find input[type='submit']" hx-disabled-elt="find input[type='submit']"
> >
{% csrf_token %} {% csrf_token %}
<div class="leave-comment-grid-container">
<div class="form-stars">
{{ form.non_field_errors() }} {{ form.non_field_errors() }}
{{ form.author.errors }} {{ form.author.errors }}
{{ form.ue.errors }} {{ form.ue.errors }}
{{ form.author }} {{ form.author }}
{{ form.ue }} {{ form.ue }}
<div class="comment-form-content">
<div class="input-stars"> <div class="form-stars">
<label for="{{ form.grade_global.id_for_label }}">{{ form.grade_global.label }} :</label> <fieldset>
<legend>{{ form.grade_global.label }} :</legend>
{{ form.grade_global.errors }} {{ form.grade_global.errors }}
{{ form.grade_global }} {{ form.grade_global }}
</div> </fieldset>
<fieldset>
<div class="input-stars"> <legend>{{ form.grade_utility.label }} :</legend>
<label for="{{ form.grade_utility.id_for_label }}">{{ form.grade_utility.label }} :</label>
{{ form.grade_utility.errors }} {{ form.grade_utility.errors }}
{{ form.grade_utility }} {{ form.grade_utility }}
</div> </fieldset>
<fieldset>
<div class="input-stars"> <legend>{{ form.grade_interest.label }} :</legend>
<label for="{{ form.grade_interest.id_for_label }}">{{ form.grade_interest.label }} :</label>
{{ form.grade_interest.errors }} {{ form.grade_interest.errors }}
{{ form.grade_interest }} {{ form.grade_interest }}
</div> </fieldset>
<fieldset>
<div class="input-stars"> <legend>{{ form.grade_teaching.label }} :</legend>
<label for="{{ form.grade_teaching.id_for_label }}">{{ form.grade_teaching.label }} :</label>
{{ form.grade_teaching.errors }} {{ form.grade_teaching.errors }}
{{ form.grade_teaching }} {{ form.grade_teaching }}
</div> </fieldset>
<fieldset>
<div class="input-stars"> <legend>{{ form.grade_work_load.label }} :</legend>
<label for="{{ form.grade_work_load.id_for_label }}">{{ form.grade_work_load.label }} :</label>
{{ form.grade_work_load.errors }} {{ form.grade_work_load.errors }}
{{ form.grade_work_load }} {{ form.grade_work_load }}
</div> </fieldset>
</div> </div>
<div class="form-comment"> <div class="form-comment">
<label for="{{ form.comment.id_for_label }}">{{ form.comment.label }} :</label> <label for="{{ form.comment.id_for_label }}">{{ form.comment.label }} :</label>
@@ -56,9 +51,7 @@
{{ form.comment }} {{ form.comment }}
</div> </div>
</div> </div>
<div class="buttons"> <p><input type="submit" class="btn btn-blue"/></p>
<input type="submit" value="{% trans %}Comment{% endtrans %}" />
</div>
</form> </form>
{% if form.is_creation %} {% if form.is_creation %}
@@ -1,10 +0,0 @@
{% if object.has_user_already_commented(user) %}
<div class="leave-comment-not-allowed">
<p>{% trans %}You already posted a comment on this UE. If you want to comment again, please modify or delete your previous comment.{% endtrans %}</p>
</div>
<br>
{% endif %}
{% if not object.has_user_already_commented(user) and user.has_perm("pedagogy.add_uecomment") %}
{{ add_comment_form }}
{% endif %}
@@ -1,9 +1,18 @@
{# A few hx-partials for swapping a few parts of the main ue_detail.jinja #}
<hx-partial id="ue-grade"> <hx-partial id="ue-grade">
{% include "pedagogy/fragments/ue_detail/grade.jinja" %} {% include "pedagogy/fragments/ue_detail/grade.jinja" %}
</hx-partial> </hx-partial>
<hx-partial id="comment-form"> <hx-partial id="comment-form">
{% include "pedagogy/fragments/ue_detail/form.jinja" %} {% if object.has_user_already_commented(user) %}
<div class="leave-comment-not-allowed">
<p>{% trans %}You already posted a comment on this UE. If you want to comment again, please modify or delete your previous comment.{% endtrans %}</p>
</div>
<br>
{% elif user.has_perm("pedagogy.add_uecomment") %}
{{ add_comment_form }}
{% endif %}
</hx-partial> </hx-partial>
<hx-partial id="comments" hx-swap="innerMorph"> <hx-partial id="comments" hx-swap="innerMorph">
+8 -2
View File
@@ -73,11 +73,17 @@
</section> </section>
</div> </div>
<br> <br>
<div id="comment-form"> <div id="comment-form">
{% include "pedagogy/fragments/ue_detail/form.jinja" %} {% if object.has_user_already_commented(user) %}
<div class="leave-comment-not-allowed">
<p>{% trans %}You already posted a comment on this UE. If you want to comment again, please modify or delete your previous comment.{% endtrans %}</p>
</div>
<br>
{% elif user.has_perm("pedagogy.add_uecomment") %}
{{ add_comment_form }}
{% endif %}
</div> </div>
<div id="comments"> <div id="comments">