{% extends "feature_vote/base.html" %}{% load comments %}
{% load i18n %}
{% block content %}

<div class="section">
  <div class="header">
    <h2>{{ feature.title }}</h2>
    {% include "feature_vote/vote.html" %}
  <p>
    <small>
        {% blocktrans with feature.user_name as user_name and feature.created|timesince as timesince_created %}Suggested by {{ user_name }}; added {{ timesince_created }} ago{% endblocktrans %}
    </small>
  </p>

    <p>{{ feature.description|linebreaksbr }}</p>
  </div>

{% get_comment_list for feature as comments %}
{% if comments %}

  <ul class="content-list">
    {% for comment in comments %}
        <li{% if comment.user.is_superuser %} class="superuser-comment"{% endif %}>
            <h3>
                {% if comment.user.is_superuser %}
                    {% blocktrans with comment.user_name as username and comment.submit_date|timesince as timesince %}Posted by {{ user_name }} ({{ site_name }} team member) {{ timesince }} ago{% endblocktrans %}
                {% else %}
                    {% blocktrans with comment.user_name as username and comment.submit_date|timesince as timesince %}Posted by {{ user_name }} {{ timesince }} ago{% endblocktrans %}
                {% endif %}
            </h3>
            <p>{{ comment.comment|linebreaksbr }}</p>
        </li>
    {% endfor %}
  </ul>

{% else %}

  <div class="section-content">
	<p>{% trans "There aren't any comments yet" %}</p>
  </div>
{% endif %}
</div>

<div class="form-section">
  {% get_comment_form for feature as form %}
  <div class="header">
    <h2>{% trans "Add a comment" %}</h2>
  </div>
  {# It doesn't have an AJAX handler, but this is handled by Django, not by us, so we can't give proper responses #}
  <form method="post" action="{% comment_form_target %}" class="has-ajax-handler">
    {% csrf_token %}
    {{ form.content_type }}
    {{ form.object_pk }}
    {{ form.timestamp }}
    {{ form.security_hash }}
    <dl>
      <dt>{{ form.name.label_tag }}:</dt>
      <dd>{{ form.name.errors }}{{ form.name }}</dd>
      <dt>{{ form.email.label_tag }}:</dt>
      <dd>{{ form.email.errors }}{{ form.email }}</dd>
      <dt>{{ form.comment.label_tag }}:</dt>
      <dd>{{ form.comment.errors }}{{ form.comment }}</dd>
      <dt class="invisible">{{ form.honeypot.label_tag }}:</dt>
      <dd class="invisible">{{ form.honeypot.errors }}{{ form.honeypot }}</dd>
    </dl>
    
    <p class="submit-buttons">
      <input type="submit" value="{% trans 'Submit' %}" />
    </p>

    <div class="clear"></div>
  </form>
</div>

{% endblock %}

