{% 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"><a href=".">{% trans "Pages" %}</a></li>
</ul>
{% endblock %}

{% block header %}
<div class="page-header action">
	<h1>{% trans "Page Management" %}</h1><a href="#" class="pull_out">{% trans "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="{% trans "Search" %}" class="btn btn-primary"/>
           </div>
        </form>
    </div>
</div>
{% endblock header %}

{% block dashboard_content %}

<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>
</tbody>
    {% endfor %}
</table>

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

<a class="btn btn-primary btn-large" href="{% url dashboard:page-create %}">{% trans "Create new page" %}</a>

{% else %}

<p>{% trans "No pages found." %}</p>

{% endif %}

{% endblock dashboard_content %}

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