{% extends "admin/change_form.html" %}
{% load admin_static %}

{% block extrahead %}{{ block.super }}<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="{% static "js/menus_manager.js" %}"></script>{% endblock %}
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /><link rel="stylesheet" type="text/css" href="{% static "css/menus_manager.css" %}" />{% endblock %}

{% block content %}
    {{ block.super }}
    {% if original.pk %}
    <p id="edit-message"></p>
    <ul id="item-list" class="connected-sortable">
        {% for item in original.get_first_level %}
            {% include "admin/menus_manager/snippets/block_menu_item.html" %}
        {% endfor %}
    </ul>
    <h3>Ajouter un élément</h3>
    <p id="add-message"></p>
    <ul id="new-item">
        <li class="ui-state-default">
             <form name="add-item" action="/api-menu/add/item/" method="post">
                <input id="menu-pk_new" type="hidden" name="menu-pk" value="{{ original.pk }}" />
                <label for="nav_title_new">Titre : </label><input id="nav_title_new" type="text" name="nav_title" value="" /> <label for="url_new">URL : </label><input id="url_new" type="text" name="url" value="" /> <a class="expands"><span class="ui-icon ui-icon-carat-2-n-s">détails</span></a> <button type="submit"><span class="ui-icon ui-icon-circle-check">enregistrer</span></button><br />
                <fieldset class="menu-item-detail">
                    <legend>Détails</legend>
                    <label for="css_class_new">Classes CSS : </label><input id="css_class_new" type="text" name="css_class" value="" /><br />
                    <label for="target_blank_new">Ouvrir dans une nouvelle fenêtre : </label><input id="target_blank_new" type="checkbox" name="target_blank" /><br />
                    <label for="html_title_new">Titre html :</label><input id="html_title_new" type="text" name="html_title" value="" /><br />
                    <label for="description_new">Description :</label><br /><textarea id="description_new" name="description"></textarea><br />
                </fieldset>
                {% csrf_token %}
            </form>
         </li>
    </ul>
    {% else %}
    <p>Pour ajouter des entrées de menu, vous devez d'abord enregistrer l'en-tête.</p>
    {% endif %}
{% endblock %}
