{% import "widgets/user.html" as widget_user %} {% import "widgets/attachments.html" as widget_attachments %} {# Thread widget: this widget expands to a table that shows a list of comments from a thread, along with message controls. comments: List of comments to render top_comment: Thread's top comment (will be elided if encountered) #} {% macro thread(comments, top_comment, owner=None) %} {% for c in comments %} {% if c != top_comment %} {% elif loop.index0 != 0 %} {% endif %} {% endfor %}
{{ widget_user.profile(c.author) }}
{% if c.date_created != c.date_modified %} {% endif %} {# TODO: Let guests edit their posts #} {% set can_edit = current_user.is_authenticated and current_user.can_edit_post(c) %} {% set can_delete = current_user.is_authenticated and current_user.can_delete_post(c) %} {% set can_punish = current_user.is_authenticated and current_user.priv("delete.posts") %} {% set can_topcomm = current_user.is_authenticated and current_user.can_set_topcomment(c) %} {% if can_edit or can_delete or can_punish %}
{% if can_edit %} Modifier {% endif %} {% if can_punish %} Supprimer (normal) Supprimer (pénalité) {% elif can_delete %} Supprimer {% endif %} {% if can_topcomm %} Utiliser comme en-tête {% endif %}
{% endif %}
{{ c.text|md }} {{ widget_attachments.attachments(c) }} {% if c.author.signature %}
{{ c.author.signature|md }} {% endif %}
Le commentaire à cet endroit est actuellement utilisé comme en-tête.
{% endmacro %} {# Thread leader widget: this widget expands to a single-message thread which can show more text when called. This is intended for programs and similar objects which display metadata before description and comments. leader: Posts's top comment (actual rendering is delegated to caller) #} {% macro thread_leader(leader) %} {# Empty line to get normal background (instead of alternate one) #}
{{ widget_user.profile(leader.author) }} {{ caller() }}
{% endmacro %}