{% extends "organization/edit_base.html" %}

{% block subtitle %}{{ _('Members') }} - {{ super() }}{% endblock %}

{% block page_primary_action %}
  {% link_for _('Add Member'), controller='organization', action='member_new', id=c.group_dict.id, class_='btn btn-primary', icon='plus-sign-alt' %}
{% endblock %}

{% block primary_content_inner %}
  <h3 class="page-heading">{{ _('{0} members'.format(c.members|length)) }}</h3>
  <table class="table table-header table-hover table-bordered">
    <col width="70" />
    <col width="40" />
    <col width="20" />
    <thead>
      <tr>
        <th scope="col">{{ _('User') }}</th>
        <th scope="col">{{ _('Role') }}</th>
        <th scope="col"></th>
      </tr>
    </thead>
    <tbody>
      {% for user_id, user, role in c.members %}
        <tr>
          <td class="media">
            {{ h.linked_user(user_id, maxlength=20) }}
          </td>
          <td>{{ role }}</td>
          <td>
            {% set locale = h.dump_json({'content': _('Are you sure you want to delete this member?')}) %}
            <div class="btn-group pull-right">
              <a class="btn btn-small" href="{% url_for controller='organization', action='member_new', id=c.group_dict.id, user=user_id %}" title="{{ _('Edit') }}">
                <i class="icon-wrench"></i>
              </a>
              <a class="btn btn-danger btn-small" href="{% url_for controller='organization', action='member_delete', id=c.group_dict.id, user=user_id %}" data-module="confirm-action" data-module-i18n="{{ locale }}" title="{{ _('Delete') }}">{% block delete_button_text %}<i class="icon-remove"></i>{% endblock %}</a>
            </div>
          </td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
{% endblock %}
