{% extends "zinnia:zinnia/entry_detail_base.html" %}
{% load static i18n comments zinnia_tags mptt_tags %}

{% block link %}
  {{ block.super }}
  <link rel="stylesheet" type="text/css" href="{% static "zinnia_threaded_comments/css/comment-reply.css" %}" />
{% endblock link %}

{% block script %}
  {{ block.super }}
  {% if object.comments_are_open %}<script type="text/javascript" src="{% static "zinnia_threaded_comments/js/comment-reply.js" %}"></script>{% endif %}
{% endblock %}

{% block comments-loop %}
  <ol id="comment-list" class="comment-root">
    {% recursetree comment_list %}
    {% with comment=node %}
    <li id="comment-{{ comment.pk }}-by-{{ comment.user_name|slugify }}"
        class="comment vcard {% cycle box1,box2 %}{% if comment.user %} authenticated-comment{% if comment.user.is_staff %} staff-comment{% endif %}{% if comment.user.is_superuser %} superuser-comment{% endif %}{% endif %}">
      <img src="{% get_gravatar comment.email 60 "G" %}"
           class="gravatar photo" alt="{{ comment.name }}" />
      {% block comment-info %}
      <p class="comment-info">
	{% if comment.url %}
	<a href="{{ comment.url }}" rel="external nofollow"
           class="fn url">{{ comment.name }}</a>
	{% else %}
	<span class="fn">{{ comment.name }}</span>
	{% endif %}
	{% trans "on" context "on date" %}
        <abbr class="comment-published" title="{{ comment.submit_date|date:"c" }}">
          {{ comment.submit_date|date:"SHORT_DATETIME_FORMAT" }}
        </abbr>
        <a href="#comment-{{ comment.pk }}-by-{{ comment.user_name|slugify }}"
           id="c{{ comment.pk }}" class="anchor-link"
           title="{% trans "Direct link to this comment" %}">#</a>
      </p>
      {% endblock comment-info %}
      {% block comment-content %}
      {{ comment.comment|linebreaks }}
      {% endblock comment-content %}
      {% block comment-reply-link %}
      {% if object.comments_are_open %}
      <p class="comment-reply">
        <a href="#comment-form" onclick="return addComment.moveForm('comment-{{ comment.pk }}-by-{{ comment.user_name|slugify }}', '{{ comment.pk }}', 'comment-form')">{% trans "Reply" %}</a>
      </p>
      {% endif %}
      {% endblock comment-reply-link %}
    </li>
    {% block comment-replies %}
    {% if not comment.is_leaf_node %}
    <li class="reply">
      <ol class="comment-children">
        {{ children }}
      </ol>
    </li>
    {% endif %}
    {% endblock comment-replies %}
    {% endwith %}
    {% endrecursetree %}
  </ol>
{% endblock comments-loop %}
