mirror of
https://github.com/ae-utbm/sith.git
synced 2026-09-17 17:54:22 +00:00
130 lines
4.7 KiB
Django/Jinja
130 lines
4.7 KiB
Django/Jinja
{% from "pedagogy/macros.jinja" import display_star %}
|
|
{% from "core/macros.jinja" import user_profile_link %}
|
|
|
|
{% if comments %}
|
|
<h2>{% trans %}Comments{% endtrans %}</h2>
|
|
<br>
|
|
{% endif %}
|
|
|
|
<section>
|
|
{%- for comment in comments -%}
|
|
<article
|
|
id="comment-{{ comment.id }}"
|
|
class="comment {% if comment.is_reported %}reported{% endif %}"
|
|
>
|
|
{% if comment.is_reported %}
|
|
<div class="alert alert-red">
|
|
<div class="alert-main">
|
|
<h5 class="alert-title margin-bottom">
|
|
{% trans %}This comment has been reported{% endtrans %}
|
|
</h5>
|
|
<p>{% trans %}It will be hidden until moderated.{% endtrans %}</p>
|
|
{% if user.has_perm("pedagogy.view_uecommentreport") %}
|
|
{% for report in comment.reports.all() %}
|
|
<div class="markdown margin-bottom">
|
|
<blockquote>
|
|
<em>{{ report.reporter.get_display_name() }}</em>
|
|
{{ report.reason|markdown }}
|
|
</blockquote>
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
</div>
|
|
{% if user.has_perm("pedagogy.delete_uecomment") %}
|
|
<div class="alert-aside">
|
|
<a
|
|
href="{{ url("pedagogy:comment_delete", comment_id=comment.id) }}"
|
|
class="btn btn-red"
|
|
>
|
|
<i class="fa fa-trash"></i>{% trans %}Delete{% endtrans %}
|
|
</a>
|
|
<a href="{{ url("pedagogy:moderation") }}" class="btn btn-green">
|
|
<i class="fa fa-check"></i>{% trans %}Moderate{% endtrans %}
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
<div class="comment-header">
|
|
<img
|
|
{% if comment.author.avatar_pict %}
|
|
src="{{ comment.author.avatar_pict.get_download_url() }}"
|
|
{% elif comment.author.profile_pict %}
|
|
src="{{ comment.author.profile_pict.get_download_url() }}"
|
|
{% else %}
|
|
src="{{ static("core/img/unknown.jpg") }}"
|
|
{% endif %}
|
|
alt="{% trans %}Profile{% endtrans %}"
|
|
/>
|
|
<div class="comment-metadata">
|
|
<a href="{{ comment.author.get_absolute_url() }}">
|
|
<strong>{{ comment.author.get_display_name() }}</strong>
|
|
</a>
|
|
<time datetime="{{ comment.publish_date.isoformat(timespec="seconds") }}">
|
|
{{ comment.publish_date|localtime|date(DATETIME_FORMAT) }}
|
|
{{ comment.publish_date|localtime|time(DATETIME_FORMAT) }}
|
|
</time>
|
|
</div>
|
|
<div class="comment-options">
|
|
{% if user.can_edit(comment) %}
|
|
<a
|
|
class="clickable"
|
|
hx-get="{{ url('pedagogy:comment_update', comment_id=comment.id) }}"
|
|
hx-swap="outerHTML"
|
|
hx-target="#comment-{{ comment.id }}"
|
|
tooltip="{% trans %}Edit{% endtrans %}"
|
|
>
|
|
<i class="fa fa-pencil edit-action"></i>
|
|
</a>
|
|
{% endif %}
|
|
{% if not comment.is_reported %}
|
|
<a
|
|
class="clickable"
|
|
hx-get="{{ url('pedagogy:comment_report', comment_id=comment.id) }}"
|
|
hx-swap="outerHTML"
|
|
hx-target="#comment-{{ comment.id }}"
|
|
tooltip="{% trans %}Report{% endtrans %}"
|
|
>
|
|
<i class="fa fa-exclamation delete-action"></i>
|
|
</a>
|
|
{% endif %}
|
|
{% if user.has_perm("pedagogy.delete_uecomment") %}
|
|
<a
|
|
href="{{ url("pedagogy:comment_delete", comment_id=comment.id) }}"
|
|
tooltip="{% trans %}Delete{% endtrans %}"
|
|
>
|
|
<i class="fa fa-trash-can delete-action"></i>
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="comment-stars">
|
|
<div>
|
|
<span>{% trans %}Global grade{% endtrans %}</span>
|
|
<span>{{ display_star(comment.grade_global) }}</span>
|
|
</div>
|
|
<div>
|
|
<span>{% trans %}Utility{% endtrans %}</span>
|
|
<span>{{ display_star(comment.grade_utility) }}</span>
|
|
</div>
|
|
<div>
|
|
<span>{% trans %}Interest{% endtrans %}</span>
|
|
<span>{{ display_star(comment.grade_interest) }}</span>
|
|
</div>
|
|
<div>
|
|
<span>{% trans %}Teaching{% endtrans %}</span>
|
|
<span>{{ display_star(comment.grade_teaching) }}</span>
|
|
</div>
|
|
<div>
|
|
<span>{% trans %}Workload{% endtrans %}</span>
|
|
<span>{{ display_star(comment.grade_work_load) }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="comment-content">
|
|
{{ comment.comment|markdown }}
|
|
</div>
|
|
</article>
|
|
{%- endfor -%}
|
|
</section>
|