{% load form_helpers %}
{% load helpers %}

<div class="modal fade" tabindex="-1" id="{{ form_name }}_form">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">{{ form_name }}</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal userconfigform" data-config-root="forms.{{ form_as_dialog.form_name }}" action="{{ form_action_url }}" method="post">
                    {% csrf_token %}
                    <h3>
                        {% if obj %}
                            <div class="pull-right">
                                <a href="{{ obj|get_docs_url }}" target="_blank" class="btn btn-link btn-xs" title="Help">
                                    <i class="mdi mdi-help-circle"></i>
                                </a>
                            </div>
                        {% endif %}
                        {% block title %}{% if editing %}Editing {{ obj_type }} {{ obj }}{% else %}Add a new:{% endif %}{% endblock %}
                    </h3>
                    {% block form %}
                        {% block form_fields %}
                            {% render_form form %}
                        {% endblock %}
                    {% endblock %}
                    <div class="row">
                        <div class="col-md-6 col-md-offset-3 text-right">
                            {% block buttons %}
                                {% if editing %}
                                    <button type="submit" name="_update" class="btn btn-primary">Update</button>
                                {% else %}
                                    <button type="submit" name="_create" class="btn btn-primary">Create</button>
                                {% endif %}
                                <a href="" class="btn btn-default" data-dismiss="modal" aria-label="Close">Cancel</a>
                            {% endblock %}
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

