{% extends "cranefly/layout.html" %}
{% import "_forms.html" as form_theme with context %}
{% import "cranefly/macros.html" as macros with context %}

{% block title %}{{ macros.page_title(title=_("Split Thread"),parent=thread.name) }}{% endblock %}

{% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
{{ macros.parents_list(parents) }}
<li><a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}">{{ thread.name }}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
<li class="active">{% trans %}Split Thread{% endtrans %}
{%- endblock %}

{% block container %}
<div class="page-header header-primary">
  <div class="container">
    {{ messages_list(messages) }}
    <ul class="breadcrumb">
      {{ self.breadcrumb() }}</li>
    </ul>
    <h1>{% trans %}Split Thread{% endtrans %} <small>{{ thread.name }}</small></h1>
  </div>
</div>

<div class="container container-primary">
  <div class="row">
    <div class="span6 offset3">
      <div class="form-container">

        <div class="form-header">
          <h1>{% trans %}Split Thread{% endtrans %}</h1>
        </div>

        {% if message %}
        <div class="messages-list">
          {{ macros.draw_message(message) }}
        </div>
        {% endif %}

        <form action="{% url 'thread' thread=thread.pk, slug=thread.slug %}" method="post">
          <input type="hidden" name="origin" value="posts_form">
          <input type="hidden" name="list_action" value="split">
          <input type="hidden" name="do" value="split">
          {% for post in posts -%}
          <input type="hidden" name="list_items" value="{{ post }}">
          {% endfor %}
          <div class="form-fields">
            {{ form_theme.form_widget(form, width=6) }}
          </div>
          <div class="form-actions">
            <button type="submit" class="btn btn-primary">{% trans %}Split Thread{% endtrans %}</button>
            <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="btn">{% trans %}Cancel{% endtrans %}</a>
          </div>
        </form>

      </div>
    </div>
  </div>
</div>
{% endblock %}