{% load i18n %}
{% load comments %}
{% load comments_xtd %}

<div class="media" id="c{{ comment.id }}">
  <a name="c{{ comment.id }}"></a>
  <div class="media-left">{{ comment.user_email|xtd_comment_gravatar }}</div>
  <div class="media-content">
    <div class="content">
        <div class="media-heading">
          {% if comment.url and not comment.is_removed %}<a href="{{ comment.url }}" target="_new">{% endif %}<strong>{{ comment.name }}</strong>{% if comment.url %}</a>{% endif %}{% if comment.user and comment.user|has_permission:"django_comments.can_moderate" %}&nbsp;<span>({% trans "moderator" %})</span>{% endif %}&nbsp;&nbsp;<a class="permalink" title="{% trans 'comment permalink' %}" href="{% get_comment_permalink comment %}">¶</a>
          {% if not comment.is_removed %}
          <div class="text-right">
            {% if allow_flagging and item.flagged %}
            <span class="glyphicon glyphicon-flag text-danger" title="{% trans 'comment flagged' %}"></span>
            {% elif allow_flagging %}
            <a class="mutedlink" href="{% url 'comments-flag' comment.pk %}">
              <span class="glyphicon glyphicon-flag" title="{% trans 'flag comment' %}"></span></a>
            {% endif %}
            {% if perms.comments.can_moderate %}
            <a class="mutedlink" href="{% url 'comments-delete' comment.pk %}"><span class="glyphicon glyphicon-trash" title="{% trans 'remove comment' %}"></span></a>
            {% if item.flagged_count %}
              <span class="label label-warning" title="{% blocktrans count counter=item.flagged_count %}A user has flagged this comment as inappropriate.{% plural %}{{ counter }} users have flagged this comment as inappropriate.{% endblocktrans %}">{{ item.flagged_count }}</span>
            {% endif %}
            {% endif %}
          </div>
          {% endif %}
        </div>
        {% if comment.is_removed %}
          <p class="text-muted"><em>{% trans "This comment has been removed." %}</em></p>
          {% else %}
            {% include "includes/django_comments_xtd/comment_content.html" with content=comment.comment %}
            <br/>
          <small>
          {% if allow_feedback %}
            {% include "includes/django_comments_xtd/user_feedback.html" %} ·
          {% endif %}
            {% if comment.allow_thread %}<a data-href="{{ comment.get_reply_url }}" class="small reply-link">{% trans "Reply" %}</a>{% endif %} · {{ comment.submit_date|timesince }}</small>
        {% endif %}
      {% if not comment.is_removed and item.children %}
        {% render_xtdcomment_tree with comments=item.children %}
      {% endif %}
    </div>
  </div>
</div>
