{% extends "mongonaut/base.html" %}
{% load mongonaut_tags %}

{% block breadcrumbs %}
<li><a href="{% url index %}">Mongonaut</a> <span class="divider">/</span></li>
<li><a href="{% url document_list app_label document_name %}">{{ document_name }}s</a> <span class="divider">/</span></li>
<li><a href="{% url document_detail app_label document_name document.id %}">{{ document_name }} {{ document.id }}</a> <span class="divider">/</span></li>
<li><a href="">Edit</a>
{% endblock %}

{% block content %}

<h1>Edit {{ document_name }}</h1>

<form method="POST" action="">
{% csrf_token %}
<div class="row">
    <div class="span6">
        <h2>Main Document</h2>        
        <fieldset>
            {% for field in form %}
                {% include "mongonaut/includes/_field.html" %}
            {% endfor %}
        </fieldset>      
        <div class="btn-group">
            <input type="submit" name="action" class="btn btn-primary" value="Save">

            <input type="submit" name="action" class="btn btn-disabled" readonly value="Save and continue editing">
            <input type="submit" name="action" class="btn btn-disabled" readonly value="Save and add another">
            <a href="#" id="action_delete" 
                class="btn btn-danger{% if not has_delete_permission %} disabled{%endif%}" {% if not has_delete_permission %}readonly{% endif %}>
                    <i class="icon-trash icon-white"></i> Delete
            </a>

        </div>     
        {% include "mongonaut/includes/_delete_warning.html" %}
    </div>   
    <div class="span5 offset1">
        <h2>Internal Documents</h2>
        <p>TODO - include EmbeddedDocumentFields, ListFields here</p>
    </div>
</div>
</form>        
  

{% endblock %}

{% block extrajs %}
<form method="post" id="delete_form" action="{% url document_delete app_label document_name document.id %}">
{% csrf_token %}
</form>
{% endblock %}
