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