mirror of
https://github.com/ae-utbm/sith.git
synced 2026-08-28 08:09:16 +00:00
Make ue comments a fragment
This commit is contained in:
@@ -6,13 +6,8 @@
|
||||
{% endif %}
|
||||
<form
|
||||
hx-post="{{ action }}"
|
||||
{% if form.is_creation %}
|
||||
hx-target="#comments"
|
||||
hx-swap="afterbegin"
|
||||
{% else %}
|
||||
hx-target="closest .leave-comment"
|
||||
hx-swap="outerHTML"
|
||||
{% endif %}
|
||||
hx-target="closest .leave-comment"
|
||||
hx-swap="outerHTML"
|
||||
hx-disabled-elt="find input[type='submit']"
|
||||
>
|
||||
{% csrf_token %}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<section
|
||||
hx-get="{{ url("pedagogy:ue_comments", ue_id=object.id) }}"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="this"
|
||||
hx-trigger="NewComment from:body"
|
||||
>
|
||||
{% if comments %}
|
||||
<h2>{% trans %}Comments{% endtrans %}</h2>
|
||||
<br>
|
||||
{% endif %}
|
||||
|
||||
{% for comment in comments %}
|
||||
{% include "pedagogy/fragments/ue_comment.jinja" %}
|
||||
{% endfor %}
|
||||
</section>
|
||||
|
||||
|
||||
@@ -40,11 +40,6 @@
|
||||
<br>
|
||||
{% endif %}
|
||||
|
||||
{% if comments %}
|
||||
<h2>{% trans %}Comments{% endtrans %}</h2>
|
||||
<br>
|
||||
{% endif %}
|
||||
|
||||
{% if not object.has_user_already_commented(user) and user.has_perm("pedagogy.add_uecomment") %}
|
||||
{{ add_comment_form }}
|
||||
{% endif %}
|
||||
|
||||
@@ -61,11 +61,7 @@
|
||||
|
||||
{% include "pedagogy/fragments/ue_detail.jinja" %}
|
||||
|
||||
{% for comment in comments %}
|
||||
<section id="comments">
|
||||
{% include "pedagogy/fragments/ue_comment.jinja" %}
|
||||
</section>
|
||||
{% endfor %}
|
||||
{{ comments }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user