{% extends 'dashboard/layout.html' %}
{% load dashboard_tags %}
{% block body_class %}pages{% endblock %}
{% block title %}
Pages | {{ block.super }}
{% endblock %}

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

{% block header %}
<div class="page-header action">
    <h1>Page Management</h1><a href="#" class="pull_out">Search Pages</a>
    <div class="orders_search" style="display:none">
        <form action="." method="get" class="form-horizontal">
            {% include "partials/form_fields.html" with form=form %}
           <div class="form-actions">
               <input type="submit" value="Search" class="btn btn-primary"/>
           </div>
        </form>
    </div>
</div>
{% endblock header %}

{% block dashboard_content %}

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

<form action="{% url dashboard:page-create %}" method="get" class="form-horizontal">
        <input type="submit" value="Create New Page" class="btn-primary" />
</form>

{% if flatpage_list.count %}
<form action="." method="post">
    {% csrf_token %}
<table class="table table-striped table-bordered">
    <tr>
        <th>Title</th>
        <th>URL</th>
        <th></th>
    </tr>
    {% 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 }}">View</a>
            <a class="btn btn-success" href="{% url dashboard:page-update page.id %}">Edit</a>
            <a class="btn btn-danger" href="{% url dashboard:page-delete page.id %}">Delete</a>
        </td>
    </tr>
    {% endfor %}
</table>

{% if page_obj %}
    {% include "catalogue/partials/pagination.html" %}
{% endif %}
</form>

{% else %}

<p>No pages found.</p>

{% endif %}

{% endblock dashboard_content %}

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