{% extends "page.html" %}

{% block subtitle %}{{ c.group_dict.display_name }}{% endblock %}

{% block breadcrumb_content %}
  <li>{% link_for _('Groups'), controller='group', action='index' %}</li>
  <li class="active">{% link_for c.group_dict.display_name|truncate(35), controller='group', action='read', id=c.group_dict.name %}</li>
{% endblock %}

{% block actions_content %}
  {% if h.check_access('organization_member_create', {'id': c.group_dict.id}) %}
    <li>{% link_for _('Add Member'), controller='group', action='member_new', id=c.group_dict.id, class_='btn', icon='plus' %}</li>
  {% endif %}
{% endblock %}

{% block primary_content %}
  <section class="module">
    <div class="module-content">
      <h1 class="page-heading">{{ _('Members') }}</h1>
      <table class="table table-bordered">
        {% for user_id, user, role in c.members %}
        <tr>
          <td class="media">{{ h.linked_user(user_id, maxlength=20) }}</td>
          <td>{{ role }}</td>
          <td>{% link_for _('Edit'), controller='group', action='member_new', id=c.group_dict.id, class_='btn', user=user_id %}</td>
          {% set locale = h.dump_json({'content': _('Are you sure you want to delete this member?')}) %}
          <td><a class="btn btn-danger" href="{% url_for controller='group', action='member_delete', id=c.group_dict.id, user=user_id %}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a></td>
        </tr>
        {% endfor %}
      </table>
    </div>
  </section>
{% endblock %}

{% block secondary_content %}
  {% snippet 'snippets/group.html', group=c.group_dict %}
{% endblock %}

{% block links %}
  {{ super() }}
  {% include "group/snippets/feeds.html" %}
{% endblock %}
