{% extends 'base.html' %}

{% load i18n %}
{% load staticfiles %}

{% block title %}{% trans "Configuration" %} – {{ block.super }}{% endblock %}

{% block content %}
<h1>
    {% trans 'Configuration' %}
    <small>{% trans active_config_page.title %}</small>
    <small class="pull-right">
        <div class="btn-toolbar">
            <div class="btn-group">
            {% for config_page_dict in config_pages_list %}
                <a href="/config/{{ config_page_dict.config_page.url }}/" class="btn btn-mini {% if config_page_dict.active %}active{% endif %}">{% trans config_page_dict.config_page.title %}</a>
            {% endfor %}
            </div>
        </div>
    </small>
</h1>
<form action="" method="post">{% csrf_token %}
    {% for group in groups %}
        <fieldset>
            <legend>{{ group.title }}</legend>
            {% for field in form %}
                {% if field.name in group.get_field_names %}
                    <div class="control-group {% if field.errors %}error{% endif%}">
                        <label for="id_{{ field.name }}">{{ field.label }}{% if field.field.required %}<span class="required">*</span>{% endif %}:</label>
                        {{ field }}
                        {% if field.errors %}
                            <span class="help-inline">{{ field.errors }}</span>
                        {% endif %}
                        {% if field.help_text %}
                            <span class="help-inline">{{ field.help_text }}</span>
                        {% endif %}
                    </div>
                {% endif %}
            {% endfor %}
        </fieldset>
    {% empty %}
        {% include 'form.html' %}
    {% endfor %}
    <p>
        {% include 'formbuttons_save.html' %}
        <a href="/config/{{ active_config_page.url }}/" class="btn">{% trans 'Cancel' %}</a>
    </p>
    <small>* {% trans 'required' %}</small>
</form>
{% endblock %}
