{% extends "base/base.html" %}
{% load url from future %}


{% block title %}Create {{ opts.verbose_name.title }}{% endblock title %}


{% block header %}Create {{ opts.verbose_name.title }}{% endblock header %}

{% block links %}
    <a class="btn" href="..">Back</a>
{% endblock links %}

{% block detail %}
<form enctype="multipart/form-data" class="form-horizontal" action="." method="post">{% csrf_token %}
    {% block form %}
    {% include "forms/bootstrap.html" %}
    {% endblock form %}
    
    {% for inline in inlines %}
    <div class="control-group">
        <div class="controls">
            {{ inline }}
        </div>
    </div>
    {% endfor %}
         
    <div class="control-group">
        <div class="controls">
            <button class="btn btn-primary">{% block button-text %}Create {{ opts.verbose_name.title }}{% endblock button-text %}</button>
        </div>        
    </div>
</form>
{% endblock detail %}


{% block extrastyles %}
<link rel="stylesheet" href="{{ STATIC_URL }}select2/select2.css" />
{% endblock extrastyles %}


{% block extrascripts %}
<script src="{{ STATIC_URL }}select2/select2.js"></script>
<script src="{{ STATIC_URL }}scripts/jquery.formset.min.js"></script>
<script>
// {% for inline in inlines %}
$('#{{ inline.opts.object_name }}-inline tbody tr').formset({
   prefix: '{{ inline.formset.prefix }}',
   formCssClass: 'dynamic-formset{{ forloop.counter }}'
});
// {% endfor %}
</script>
{% endblock extrascripts %}
