{% load i18n  %}

{% block head %}
    {{ form.media }}
{% endblock %}

{% block body %}
<div class="table-container">
    <h4>
        {{ form.form_title }}
    </h4>
    {% if form.form_caption is not None %}
    <div>
        {{ form.form_caption }}
    </div>
    {% endif %}
    <form method="post" action="{{ form.action_url }}">
        {% csrf_token %}
        <table>
            <tbody>
                {% for field in form %}
                <tr title="{{ field.help_text }}" class="{% if field.errors %}error{% endif %}">
                    <th scope="row" class="small-3">
                        <div>{{ field.label }}<span class="label-required">{% if field.field.required %}*{% endif %}</span></div>
                        <small>{{ field.help_text }}</small>
                    </th>
                    <td class="small-12">
                        {{ field }}
                        {% for error in field.errors %}
                        <b>{{ error }}</b>
                        {% endfor %}
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
        <div class="label-required">{% trans 'Fields with * are required.' %}</div>
        <div class="row">
            <div class="large-1 columns">
                <a href="{{ form.cancel_redirect }}">
                    <button class="button small append-value" type="button" title="{% trans 'Cancel' %}">{% trans 'Cancel' %}</button>
                </a>
            </div>
            <div class="large-10 columns">
                <button class="button small append-value right" type="submit" title="{% trans 'Save' %}">{% trans 'Save' %}</button>
            </div>
        </div>
    </form>
</div>
{% endblock %}

{% block footer %}
    {{ form.media }}
{% endblock %}