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


{% block view %}
<div class="row">
  <div class="col {% block form-main-col-class %}{% endblock form-main-col-class %}">

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

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

          {% if form.is_bound and not form.is_valid %}
            {% for error in form.non_field_errors %}
              <div class="alert alert-danger" role="alert">
                {{ error }}
              </div>
            {% empty %}
              <div class="alert alert-danger" role="alert">
                {% trans "Form was completed with errors." %}
              </div>
            {% endfor %}
          {% endif %}

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

        </div>
        <div class="card-footer text-right">
          {% block form-footer-cancel %}
            <a href="{% url root_link %}" class="btn btn-light btn-sm" data-cancel-confirmation="true">
              {% trans "Cancel" %}
            </a>
          {% endblock %}
          {% block form-footer %}
            {% if target and target.pk %}
              <button class="btn btn-primary btn-sm" name="stay" value="1">
                {% trans "Save and keep editing" %}
              </button>
              <button class="btn btn-primary btn-sm">
                {% trans "Save changes" %}
              </button>
            {% else %}
              <button class="btn btn-primary btn-sm" name="stay" value="1">
                {% trans "Save and add another" %}
              </button>
              <button class="btn btn-primary btn-sm">
                {% trans "Save" %}
              </button>
            {% endif %}
          {% endblock %}
        </div>

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

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