{% extends "admin/admin/layout.html" %}
{% load i18n %}
{% load l10n %}
{% load url from future %}
{% import "_forms.html" as form_theme with context %}

{% block action_body %}
<form action="{{ url }}" method="post">
  {{ form_theme.form_hidden_widget(form) }}
  {% for fieldset in form.fieldsets %}
  <table class="table table-striped">
    <thead>
      <tr>
        <th class="lead">{{ fieldset.legend }}</th>
        <th>{% trans %}Permission{% endtrans %}</th>
      </tr>
    </thead>
    <tbody>
      {% for field in fieldset.fields %}
      <tr>
        <td>
          <strong>{{ field.label }}</strong>{% if field.help_text %}<div class="muted">{{ field.help_text }}</div>{% endif %}
        </td>
        <td class="span4">
          {{ form_theme.field_widget(field, width=4) }}
        </td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
  {% endfor %}
  <div class="form-actions">
  	{% block form_actions %}
  	{% block form_submit %}
  	<button name="save" type="submit" class="btn btn-primary">{{ action.submit_button }}</button>
  	{% endblock %}
  	{% if action.get_edit_url -%}
  	<button name="save_edit" type="submit" class="btn btn-warning">{% trans %}Save and Edit{% endtrans %}</button>
  	{%- endif %}
  	{% if action.get_new_url -%}
  	<button name="save_new" type="submit" class="btn btn-success">{% trans %}Save and Add Another{% endtrans %}</button>
  	{%- endif %}
  	{% if fallback %}<a href="{{ fallback }}" class="btn">{% trans %}Cancel{% endtrans %}</a>{% endif %}
  	{% endblock %}
  </div>
</form>
{% endblock %}