{% import "macros.html" as macros %}
{% extends "one_column_body.html" %}
{% block title %}{% trans %}Groups{% endtrans %}{% endblock %}
{% block layout_class %}groups-page with-tabs{% endblock %}
{% block content %}
    <div class="title-row">
        <h1>{% trans %}Groups{% endtrans %}</h1>
        {% if request.user.is_authenticated %}
            <div class="components--sort-nav">
                <a id="all-groups"
                    {% if tab_name=="all-groups" %}class="js-selected"{% endif %}
                    title="{% trans %}All groups{% endtrans %}"
                    href="{{ url('groups') }}?sort=all-groups"
                >{% trans %}all groups{% endtrans %}</a>
                <a id="my-groups"
                    {% if tab_name=="my-groups" %}class="js-selected"{% endif %}
                    title="{% trans %}My groups{% endtrans %}"
                    href="{{ url('groups') }}?sort=my-groups"
                >{% trans %}my groups{% endtrans %}</a>
            </div>
        {% endif %}
    </div>
    <table class="groups-list">
        <thead>
            <th>{% trans %}Group{% endtrans %}</th>
            <th>{% trans %}Number of members{% endtrans %}</th>
            <th>{% trans %}Description{% endtrans %}</th>
        </thead>
        <tbody>
        {% for group in groups %}
            <tr>
                {{ macros.user_group(
                        group, groups_membership_info[group.id], show_count=True
                    )
                }}
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endblock %}
