{% extends "cow/base.html" %}

{% block content %}
<a class="pure-button pure-button-primary" href="{% url 'page_create' %}">Create page <i class="icon-plus"></i></a>
<table class="pure-table">
    <thead>
        <tr>
            <th>name</th>
            <th>plugins</th>
            <th>created</th>
            <th>updated</th>
            <th>actions</th>
        </tr>
    </thead>
    <tbody>
    {% for page in object_list %}
        <tr>
            <td><a href="{% url 'page_update' page.pk %}">{{ page.name }}</a></td>
            <td>
                <select>
                    {% for plugin in page.plugins.all %}
                    <option value="{{ plugin.pk }}">{{ plugin }}</option>
                    {% endfor %}
                </select>
            </td>
            <td>{{ page.created }}</td>
            <td>{{ page.last_updated }}</td>
            <td>
                <a href="{% url 'page_update' page.pk %}"><i class="icon-pencil"></i></a>
                <a href="{% url 'page_delete' page.pk %}"><i class="icon-cancel"></i></a>
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>

<a class="pure-button pure-button-primary" href="{% url 'menu_create' %}">Create menu <i class="icon-plus"></i></a>
<table class="pure-table">
    <thead>
        <tr>
            <th>name</th>
            <th>children</th>
            <th>created</th>
            <th>updated</th>
            <th>actions</th>
        </tr>
    </thead>
    <tbody>
    {% for menu in menus %}
        <tr>
            <td><a href="{% url 'menu_detail' menu.pk %}">{{ menu.title }}</a></td>
            <td>
                <select>
                    {% for child in menu.children.all %}
                    <option value="{{ child.pk }}">{{ child }}</option>
                    {% endfor %}
                </select>
            </td>
            <td>{{ menu.created }}</td>
            <td>{{ menu.last_updated }}</td>
            <td>
                <a href="{% url 'menu_detail' menu.pk %}"><i class="icon-pencil"></i></a>
                <a href="{% url 'menu_delete' menu.pk %}"><i class="icon-cancel"></i></a>
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}
