{% load i18n %}
{% load url from future %}
{% load form_helpers %}

<h4>{% trans "Deployment Roles" %}</h4>
<form method="POST" action="." class="deployment-roles-form">
{% csrf_token %}
{% include 'horizon/common/_form_errors.html' with form=form %}
{% for role in roles %}
    <div class="form-group well well-sm clearfix{% if field.errors %} error{% endif %} {{ field.css_classes }}">
      <div class="col-xs-2 deploy-role-icon">
        <a
          href="{% url 'horizon:infrastructure:roles:update' role_id=role.id %}"
          class="btn"
        ><b class="fa fa-lg fa-fw fa-pencil"></b></a>
      </div>
      <div class="col-xs-8 deploy-role-name">
        <a
          href="{% url 'horizon:infrastructure:roles:detail' role_id=role.id %}"
          class="deployment-roles-label"
        >{{ role.name }}</a>
        {% for error in role.field.errors %}
        <span class="help-block"><span class="text-danger">
          {{ error }}
        </span></span>
        {% endfor %}
      </div>
      <div class="col-xs-2 deploy-role-count">
        {{ role.field|add_bootstrap_class }}
      </div>
    </div>
{% endfor %}
<hr>
<button type="submit" class="btn btn-default">
  <i class="fa fa-save"></i>
  {% trans "Save changes" %}
</button>
</form>
