{% load i18n %}

<tbody>
{% for element in comments %}
    <tr class="">
        <td class="ord">
            <span class="avatar icon icon-user" style="top:0;"></span>
        </td>
        <td class="title" valign="top" data-listing-page-title="">
            <h2>
                {% if element.has_child %}
                    <a href="{% url 'comments_wagtail_xtd_comment_thread' page.pk element.comment.pk %}"
                       title="{% trans 'Explore this thread' %}">{{ element.comment.comment }}</a><br>
                {% else %}
                    {{ element.comment.comment }}<br>
                {% endif %}
                <small>{{ element.comment.user_name }} - {{ element.comment.user_email }}</small>
            </h2>
            <ul class="actions">
                {% if element.comment.is_public %}
                    <li><a href="{{ page.url }}#c{{ element.comment.pk }}" class="button button-secondary button-small"
                           target="blank">{% trans "View live" %}</a></li>
                {% endif %}
                {% if element.comment.is_public %}
                    <li><a href="{% url 'comments_wagtail_xtd_publication' page.pk element.comment.pk 'unpublish' %}"
                           class="button button-secondary button-small"
                           title="Click to make the comment effectively disappear from the site.">{% trans "Unpublish" %}</a>
                    </li>
                {% else %}
                    <li><a href="{% url 'comments_wagtail_xtd_publication' page.pk element.comment.pk 'publish' %}"
                           class="button button-secondary button-small"
                           title="Click to display the comment">{% trans "Publish" %}</a></li>
                {% endif %}
                {% if element.comment.is_removed %}
                    <li><a href="{% url 'comments_wagtail_xtd_publication' page.pk element.comment.pk 'show' %}"
                           class="button button-secondary button-small"
                           title="Click to display the comment">{% trans "Show" %}</a></li>
                {% else %}
                    <li><a href="{% url 'comments_wagtail_xtd_publication' page.pk element.comment.pk 'hide' %}"
                           class="button button-secondary button-small"
                           title="Click if the comment is inappropriate. A 'This comment has been removed' message will be displayed instead.">{% trans "Hide" %}</a>
                    </li>
                {% endif %}
            </ul>
        </td>
        <td class="updated" valign="top">
            {{ element.comment.submit_date|date:"d M Y H:i" }}
        </td>
        <td>
            {% if not element.comment.is_public %}
                <span class="status-tag">{% trans "Deleted" %}</span>
            {% elif element.comment.is_removed %}
                <span class="status-tag">{% trans "Hidden" %}</span>
            {% else %}
                <span class="status-tag primary">{% trans "Public" %}</span>
            {% endif %}
        </td>
        {% if element.has_child %}
            <td class="children">
                <a href="{% url 'comments_wagtail_xtd_comment_thread' page.pk element.comment.pk %}"
                   class="icon text-replace icon-arrow-right"
                   title="{% trans 'Explore this thread' %}">{% trans "Explore" %}</a>
            </td>
        {% else %}
            <td></td>
        {% endif %}
    </tr>
{% endfor %}
</tbody>