{% extends "base.html" %}
{% load i18n mptt_tags autobreadcrumb documents_admin %}

{% block head_title %}{% current_title_from_breadcrumbs %}{% endblock %}
{% block head_more_links %}
    <link rel="stylesheet" href="{{ STATIC_URL }}sveedocuments/css/content.css" type="text/css" />
{% endblock %}
{% block body_attr %} class="fixed_width absolute_width"{% endblock %}

{% block content %}
<h2>{% current_title_from_breadcrumbs %}</h2>

{% if perms.sveedocuments.add_page or perms.forum.change_page or perms.forum.delete_page %}<div class="module changelist">
    <ul class="actions flat_bulletlist">
        <li class="icon add-page"><a href="{% url documents-page-add %}">{% trans "Add a new page" %}</a></li>
    </ul>
    <h3>{% trans "Pages" %}</h3>
    <div class="cale"></div>
    
    <ul class="list-tree-alt">{% recursetree page_list %}
        <li>
            <div class="container {% if not node.visible %}hidden{% endif %}">
                <div class="item-infos">
                    <h4><a href="{% url documents-page-edit node.slug %}">{{ node.title }}</a></h4>
                    <div class="panel">
                        <p class="tile visibility-{% if node.visible %}on{% else %}off{% endif %}"><strong>{{ node.get_visible_display }}</strong></p>
                        <p class="tile published">{% blocktrans with modified=node.modified|date:"d/m/Y H:i" %}Published on {{ modified }}{% endblocktrans %}</p>
                    </div>
                    <div class="cale"></div>
                </div>
                <div class="menu">
                    <p class="tile add-child">
                        <a href="{% url documents-page-add-child node.slug %}" title="{% blocktrans %}Add a new child page to this one{% endblocktrans %}">{% trans "New child page" %}</a>
                    </p>
                    <p class="tile delete">
                        <a href="{% url documents-page-delete node.slug %}" title="{% blocktrans %}Recursively delete this page and his children{% endblocktrans %}">{% trans "Delete" %}</a>
                    </p>
                </div>
                <div class="cale"></div>
            </div>
            {% if not node.is_leaf_node %}<ul class="children {% if not node.visible %}hidden_parent{% endif %}">{{ children }}</ul>{% endif %}
        </li>
    {% endrecursetree %}</ul>
</div>{% endif %}


{% if perms.sveedocuments.add_insert or perms.forum.change_insert or perms.forum.delete_insert %}<div class="module changelist">
    <ul class="actions flat_bulletlist">
        <li class="icon add-page"><a href="{% url documents-insert-add %}">{% trans "Add a new insert document" %}</a></li>
    </ul>
    <h3>{% trans "Insert documents" %}</h3>
    <div class="cale"></div>
    
    <table>
        <thead>
            <tr>
                <th class="title-cell col-odd">{% trans "Title" %}</th>
                <th class="slug-cell col-even">{% trans "Slug" %}</th>
                <th class="visible-cell col-odd">{% trans "Visibility" %}</th>
                <th class="modified-cell col-even">{% trans "Last modified" %}</th>
                <th class="actions-cell col-odd">#</th>
            </tr>
        </thead>
        <tbody>
    {% for item in insert_list %}
            <tr id="insert-row-{{ item.id }}">
                <th class="title-cell col-odd"><a href="{% url documents-insert-edit item.slug %}">{{ item.title }}</a></th>
                <td class="slug-cell col-even">{{ item.slug }}</td>
                <td class="visible-cell col-odd">{{ item.visible }}</td>
                <td class="modified-cell col-even">{{ item.modified|date:"l d F Y à H:i"|title }}</td>
                <td class="actions-cell col-odd"><a href="{% url documents-insert-delete item.slug %}">{% trans "Delete" %}</a></td>
            </tr>
        </tr>
    {% endfor %}
        </tbody>
    </table>
</div>{% endif %}
{% endblock %}
