{% extends request.is_ajax|yesno:'bajax.html,base.html' %}
{% load i18n bootstrap3 %}

{% block main %}

    {% if object %}
        {% url 'docsapp:doc_edit' object.pk as objurl %}
    {% else %}
        {% url 'docsapp:doc_add' as objurl %}
    {% endif %}

    <form action="{{ objurl }}" method="post" enctype="multipart/form-data">{% csrf_token %}
    <div class="modal-header primary">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">
            <span class="glyphicon glyphicon-exclamation-sign"></span>

            {% if object %}
                {% trans 'Change document' %}
            {% else %}
                {% trans 'Add document' %}
            {% endif %}

        </h4>
    </div>
    <div class="modal-body">
        {% bootstrap_form form %}

        <div class="btn-group btn-group-sm">
            {% bootstrap_button _('Save') button_type="submit" button_class="btn-primary" icon="save" %}

            {% if not request.is_ajax %}
                {% url 'docsapp:docs_list' as backurl %}
                {% bootstrap_button _('Back') button_type="link" href=backurl icon="fast-backward" %}
            {% endif %}
        </div>
    </div>
</form>
{% endblock %}
