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

{% block body_class %}pages{% endblock %}
{% block title %}
{{ title }} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}
<ul class="breadcrumb">
    <li>
	<a href="{% url dashboard:index %}">{% trans "Dashboard" %}</a>
        <span class="divider">/</span>
    </li>
    <li>
	<a href="{% url dashboard:page-list %}">{% trans "Pages" %}</a>
        <span class="divider">/</span>
    </li>
	<li class="active">{{ title }}</li>
</ul>
{% endblock %}
{% block header %}
<div class="page-header">
	<h1>{{ title }}</h1>
</div>
{% endblock header %}

{% block dashboard_content %}
<div class="well well-blank">
	<form action="." method="post" class="product-new form-horizontal wysiwyg" enctype="multipart/form-data">
		{% csrf_token %}
		<legend>{% trans "Page" %}</legend>
			<div class="product-details">
			<span class="help-block">{{ form.non_field_errors }}</span>
	        {% for field in form %}
	            {% if field.is_hidden %}
	                {{ field }}
	            {% endif %}
	            {% if 'attr' not in field.id_for_label %}
					<div class="control-group {% for error in field.errors %}error{% endfor %}">
	                    {% if field.is_hidden %}
	                        {{ field }}
	                    {% else %}
	                        <label for="{{ field.auto_id }}" class="control-label {% if field.field.required %}required{% endif %}">{{ field.label }}{% if field.field.required %} <span>*</span>{% endif %}</label>
	                        <div class="controls">
	                            {{ field }}
	                            {% for error in field.errors %}
	                				<span class="help-block">
								{{ error }}
	                				</span>
	                            {% endfor %}
	                            {% if field.help_text %}
	                                <span class='help-block'>
	                                    {{ field.help_text }}
	                                </span>
	                            {% endif %}
	                        </div>
	                    {% endif %}
	                </div>
				{% endif %}
	        {% endfor %}
		</div>

		<div class="form-actions">
			<button class="btn btn-primary" type="submit">{% trans "Save" %}</button> {% trans "or" %}
			<a href="{% url dashboard:page-list %}">{% trans "cancel" %}</a>
		</div>
	</form>
</div>
{% if page %}
<p><a class="btn btn-success" href="{{ page.get_absolute_url }}">{% trans "View on site" %}</a></p>
{% endif %}

{% endblock dashboard_content %}
