{% extends base %}
{% from 'macro.html' import breadcrumbs with context %}
{% from 'macro.html' import form_fields with context %}
{% block content %}

<div class="row">
    <div class="span12">
        {{- breadcrumbs([
            [url_for('admin_index.index'), _('Administration')],
            [url_for('admin_categories.index'), _('Categories')]
        ]) }}
        <h1>{{ page_title }}</h1>

        {% if edit %}
            <div><a class="gen" style="background-color: {{ category.color }}" href="{{ url_for('search.simple', search_type='category', search_id=category.id) }}">{{ category.name }}</a></div>
        {% endif %}

        {% if saved %}<div class="alert-mini green">{{ _('Saved!') }}</div>{% endif %}

        <form class="form-horizontal" method="POST" enctype="multipart/form-data">
        {{ form_fields(form) }}
        <div class="controls">
            <input type="submit" value="{{ _('Save') }}" class="btn btn-primary" />
            {% if edit %}
            <a href="{{ url_for('admin_categories.delete', pk=category.id) }}" class="btn">
                {{ _('Delete') }}
            </a>
            {% endif %}
        </div>
        </form>

        {{- breadcrumbs([
            [url_for('admin_index.index'), _('Administration')],
            [url_for('admin_categories.index'), _('Categories')]
        ]) }}
    </div>
</div>
{% endblock %}
