{% extends 'dashboard/layout.html' %}
{% load currency_filters %}
{% block body_class %}content-blocks{% endblock %}


{% block header %}
<div class="page-header">
    <h1>Content block management</h1>
</div>
{% endblock header %}

{% block title %}
Pages with content blocks | {{ 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=".">Content block management</a></li>
</ul>
{% endblock %}

{% block dashboard_content %}

<div class="well well-danger">
    <h3 class="app-ico ico_view icon">View by page</h3>
    <a href="{% url dashboard:promotion-list %}" class="btn btn-primary">View all content blocks</a>
    <a href="{% url dashboard:promotion-list-by-page %}" class="btn">View content blocks by page</a>
</div>

<div class="sub-header">
    <h2>Pages with content blocks on them</h2>
</div>

{% if pages %}

<table class="table table-striped table-bordered">
	<thead>
		<tr>
			<th>URL</th>
			<th>Number of content blocks</th>
			<th>Actions</th>
		</tr>
	</thead>
	<tbody>
		{% for page in pages %}
		<tr>
			<td>{{ page.page_url }}</td>
			<td>{{ page.freq }}</td>
			<td>
                <a href="{% url dashboard:promotion-list-by-url page.page_url|urlencode:"" %}" class="btn btn-success">Edit</a>
			</td>
			<td>
			</td>
		</tr>
		{% endfor %}
	</tbody>
</table>

{% else %}

<p>No content blocks found.</p>

{% endif %}


{% endblock dashboard_content %}
