{% extends "layout.html" %}

{% block head %}
    <script type="text/javascript">
        function on_delete(root, name){
            var ans = confirm("Really delete "+name+"?")
            if(ans){
                location.href = "/configure/delete/"+root+"/"+name;
            }
        }
    </script>
{% endblock %}

{% block main %}

    {% block configure %}
    <h1>Configure</h1>
    <p>Please select task to configure.</p>
    <p><b>WARNING:</b> The config editor will change the formatting and remove comments from your config.</p>
    {% endblock %}

{% endblock %}

{% block menu %}

<dl id="cat">
    {% for category in manager.config.iterkeys() %}
    <dt><div{% if category == root|default('') %} class="selected"{% endif %}>{{ category }}</div></dt>
    <dd>
        <ul>
            {% for a_name in manager.config[category].iterkeys() %}
                <li>
                    <div class="item{% if a_name == name|default('') %} selected{% endif %}">
                        <a href="/configure/edit/text/{{ category }}/{{ a_name }}">{{ a_name }}</a>
                        <div class="actions">
                            <a href="#" onclick="on_delete('{{ category }}','{{ a_name }}')">
                            <img border="0" src="{{ url_for('static', filename='img/fatcow-icons/16x16/delete.png') }}" alt="Delete"/></a>
                        </div>
                    </div>
                </li>
            {% endfor %}
            <li class="new">
                <div class="item{% if root == category %}{% if name is undefined %} selected{% endif %}{% endif %}">
                    <a href="{{ url_for('.new_text', root=category) }}">Create new</a>
                </div>
            </li>
        </ul>
    </dd>
    {% endfor %}
</dl>

{% endblock %}
