{% extends "base.html" %}

{% block title %}Change position for {{ ad.plain_name }} on {{ doc }}{% endblock %}

{% block morecss %}
div.ballot-deferred {
  margin-top: 8px;
  margin-bottom: 8px;
}
form.position-form .position ul {
  padding: 0;
  margin: 0;
}
form.position-form .position li {
  list-style-type: none;
  float: left;
  padding-right: 10px;
}
form.position-form .last-edited {
  font-style: italic;
}
form.position-form .discuss-text {
  padding-top: 20px
}
form.position-form #id_discuss,
form.position-form #id_comment {
  width: 700px;
  height: 250px;
}
form.position-form .comment-text {
  margin-top: 20px;
}
{% endblock %}

{% block content %}
<h1>Change position for {{ ad.plain_name }} {{ doc }}</h1>

{% if ballot_deferred %}
<div class="ballot-deferred">Ballot deferred by {{ ballot_deferred.by }} on {{ ballot_deferred.time|date:"Y-m-d" }}.</div>
{% endif %}

<form class="position-form" action="" method="POST">
  <div>
  <span class="position">{{ form.position }}</span>
  <span class="actions">
    <input type="submit" name="send_mail" value="Save and send email"/>
    <input type="submit" value="Save"/>
    {% if ballot_deferred %}<input type="submit" name="Undefer" value="Undefer"/>{% else %}<input type="submit" name="Defer" value="Defer"/>{% endif %}
  </span>
  </div>

  <div style="clear:left"></div>
  
  <div class="discuss-widgets" {% ifnotequal form.position.initial "discuss" %}style="display:none"{% endifnotequal %}>
  <div class="discuss-text">
    {{ form.discuss.label_tag }}:
    {% if old_pos and old_pos.discuss_time %}<span class="last-edited">(last edited {{ old_pos.discuss_time }})</span>{% endif %}
  </div>
  {{ form.discuss.errors }}
  {{ form.discuss }}
  </div>
  
  <div class="comment-text">
    {{ form.comment.label_tag }}:
    {% if old_pos and old_pos.comment_time %}<span class="last-edited">(last edited {{ old_pos.comment_time }}){% endif %}</span>
  </div>
  {{ form.comment }}

  <div class="actions">
    <a href="{{ return_to_url }}">Back</a>
  </div>
  
  {{ form.return_to_url }}

</form>
{% endblock %}

{% block content_end %}
<script type="text/javascript" src="/js/doc-edit-position.js"></script>
{% endblock %}
