{% extends 'dashboard/layout.html' %}
{% load dashboard_tags %}
{% load i18n %}

{% block body_class %}pages{% endblock %}

{% block title %}
{% trans "Pages" %} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}
<ul class="breadcrumb">
    <li>
    <a href="{% url dashboard:index %}">{% trans "Dashboard" %}</a>
        <span class="divider">/</span>
    </li>
    <li class="active">{% trans "Pages" %}</li>
</ul>
{% endblock %}

{% block header %}
<div class="well well-info">
    <h3><i class="icon-search"></i> Search</h3>
    <form action="." method="get" class="form-inline">
        {% include "partials/form_fields_inline.html" with form=form %}
        <input type="submit" value="{% trans "Search" %}" class="btn btn-primary"/>
    </form>
</div>
{% endblock header %}

{% block dashboard_content %}

<div class="well well-success">
    <h3><i class="icon-file"></i> Create new page</h3>
    <form action="{% url dashboard:page-create %}" method="get" class="form-inline">
        <input type="submit" value="{% trans "Create" %}" class="btn btn-primary" />
    </form>
</div>

<div class="sub-header">
    <h2>{{ queryset_description }}</h2>
</div>


{% if flatpage_list.count %}
    <form action="." method="post">
        {% csrf_token %}
        <table class="table table-striped table-bordered">
            <thead>
                <tr>
                    <th>{% trans "Title" %}</th>
                    <th>{% trans "URL" %}</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
            {% for page in flatpage_list %}
            <tr>
                <td>{{ page.title}}</td>
                <td>{{ page.url}}</td>
                <td>
                    <a class="btn btn-info" href="{{ page.get_absolute_url }}">{% trans "View" %}</a>
                    <a class="btn btn-success" href="{% url dashboard:page-update page.id %}">{% trans "Edit" %}</a>
                    <a class="btn btn-danger" href="{% url dashboard:page-delete page.id %}">{% trans "Delete" %}</a>
                </td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
        {% include "partials/pagination.html" %}
    </form>
{% else %}
    <p>{% trans "No pages found." %}</p>
{% endif %}

{% endblock dashboard_content %}

{% block onbodyload %}
oscar.dashboard.search.init();
{% endblock onbodyload %}
