{% extends "comments/base.html" %}

{% load i18n %}
{% load comments_ink %}

{% block title %}{% trans "Preview your comment" %}{% endblock %}

{% block content %}
<main>
  <article>
    <h2 class="text-center">{% trans "Preview your comment" %}</h2>
    <h6 class="text-center pb24">
      {% trans "Comment sent to:" %}<br/>
      <a href="{{ form.target_object.get_absolute_url }}">{{ form.target_object }}</a>
    </h6>

    <div class="central-column">
      <div class="{% dci_custom_selector %}">
        <div class="comment-list">
          {% if form.reply_to.value == "0" %}
            <div class="comment-box l0-ini">
              {{ 0|indent_divs }}
              <div class="comment">
                <div class="header">
                  <div>{% if form.cleaned_data.url %}<a href="{{ form.cleaned_data.url }}" target="_new">{{ form.cleaned_data.name }}</a>{% else %}{{ form.cleaned_data.name }}{% endif %}</div>
                  <div class="small text-info">{% trans "comment in preview" %}</div>
                </div>
                <div class="body body-bordered">
                  {{ form.cleaned_data.comment|linebreaks|escape }}
                </div>
                <div class="feedback feedback-bordered"></div>
              </div>
            </div>
            <div class="not-reply-box l0"></div>
          {% else %}
            {% with parent=form.reply_to.value|get_comment %}
              <div class="comment-box l0-ini">
                <div class="comment">
                  <div class="header">
                    <div>{% if parent.url %}<a href="{{ parent.url }}" target="_new">{{ parent.name }}</a>{% else %}{{ parent.name }}{% endif %}&nbsp;&sdot;&nbsp;<span class="muted">{{ parent.submit_date }}</span>&nbsp;&nbsp;<a class="permalink" title="comment permalink" href="{% get_inkcomment_permalink parent page_number %}">¶</a></div>
                  </div>
                  <div class="body body-bordered">
                    {{ parent.comment|linebreaks|escape }}
                  </div>
                  <div class="feedback feedback-bordered"></div>
                </div>
              </div>
            {% endwith %}

            <div class="comment-box l0-mid">
              <div class="level-1"></div>
              <div class="comment">
                <div class="header">
                  <div>{% if form.cleaned_data.url %}<a href="{{ form.cleaned_data.url }}" target="_new">{{ form.cleaned_data.name }}</a>{% else %}{{ form.cleaned_data.name }}{% endif %}</div>
                  <div class="small text-info">{% trans "comment in preview" %}</div>
                </div>
                <div class="body body-bordered">
                  {{ form.cleaned_data.comment|linebreaks|escape }}
                </div>
                <div class="feedback feedback-bordered"></div>
              </div>
            </div>

            <div class="reply-box l0">
              <div class="line-0"></div>
              <div class="content">
                <section class="reply-form active">
                  {% include "comments/form.html" %}
                </section>
              </div>
            </div>
          {% endif %}
        </div>

        <div class="mt32">
          {% if form.reply_to.value == "0" %}
            <section class="comment-form">
              <h5 class="text-center">{% translate "Post your comment" %}</h5>
              {% include "comments/form.html" %}
            </section>
          {% endif %}
        </div>
      </div>
    </div>
  </article>
</main>
{% endblock %}
