{% extends "misago/admin/generic/base.html" %}
{% load i18n %}


{% block page-header %}
{{ block.super }}
<div class="sub">
  <span class="fa fa-chevron-right"></span>
  {% block page-target %}{% endblock page-target %}
</div>
{% endblock page-header %}


{% block view %}
<div class="row">
  <div class="col-xs-12 col-md-8 col-md-offset-2">

    <div class="form-panel">
      <form role="form" method="post" {% block form-extra %}{% endblock form-extra%}>
        {% csrf_token %}

        <div class="form-header">
          {% block form-header %}{% endblock %}
        </div>

        {% if form.is_bound and not form.is_valid %}
        <div class="form-errors-block">
          <span class="fa fa-exclamation-triangle"></span>
          <ul class="list-unstyled">
            {% for error in form.non_field_errors %}
            <li>{{ error }}</li>
            {% empty %}
            <li>{% trans "Form has errors." %}</li>
            {% endfor %}
          </ul>
        </div>
        {% endif %}

        {% block form-body %}{% endblock %}

        <div class="form-footer">
          <div class="row">
            <div class="{% block form-footer-class %}col-xs-12{% endblock form-footer-class %}">

              {% block form-footer %}
              {% if target and target.pk %}
              <button class="btn btn-primary">{% trans "Save changes" %}</button>
              <button class="btn btn-success" name="stay" value="1">{% trans "Save and keep editing" %}</button>
              {% else %}
              <button class="btn btn-primary">{% trans "Save" %}</button>
              <button class="btn btn-success" name="stay" value="1">{% trans "Save and add another" %}</button>
              {% endif %}
              {% endblock %}
              <a href="{% url root_link %}" class="btn btn-default">{% trans "Cancel" %}</a>

            </div>
          </div>
        </div>

      </form>
    </div><!-- /.form-panel -->

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