Browse Source

Show Exemplary label at the top of comments

Previously, the little "Exemplary" badge was only being shown to people
that can view the reasons (generally, the comment author and admins).
The only indication to other users that the comment had been labeled as
Exemplary was the colored left border. This adds the label to the top
for all users, including a count if there are multiple.
merge-requests/55/head
Deimos 6 years ago
parent
commit
9b64d22daf
  1. 32
      tildes/tildes/templates/macros/comments.jinja2

32
tildes/tildes/templates/macros/comments.jinja2

@ -98,18 +98,28 @@
</div>
{% endif %}
{% if (request.has_permission("view_exemplary_reasons", comment)
and comment.is_label_active("exemplary")) %}
<details class="comment-exemplary-reasons">
<summary><span class="label label-comment label-comment-exemplary">Exemplary</span>
<span class="comment-label-count">x{{ comment.label_counts["exemplary"] }}</span>
</summary>
<ul>
{% for label in comment.labels if label.name == "exemplary" %}
<li>"{{ label.reason }}"</li>
{% endfor %}
{% if comment.is_label_active("exemplary") %}
{% if request.has_permission("view_exemplary_reasons", comment) %}
<details class="comment-exemplary-reasons">
<summary><span class="label label-comment label-comment-exemplary">Exemplary</span>
<span class="comment-label-count">x{{ comment.label_counts["exemplary"] }}</span>
</summary>
<ul>
{% for label in comment.labels if label.name == "exemplary" %}
<li>"{{ label.reason }}"</li>
{% endfor %}
</ul>
</details>
{% else %}
<ul class="comment-labels">
<li>
<span class="label label-comment label-comment-exemplary">Exemplary</span>
{% if comment.label_counts["exemplary"] > 1 %}
<span class="comment-label-count">x{{ comment.label_counts["exemplary"] }}</span>
{% endif %}
</li>
</ul>
</details>
{% endif %}
{% endif %}
{% if comment.label_counts and request.has_permission("view_labels", comment) %}

Loading…
Cancel
Save