{% extends "layout.html" %}
{% from "_helpers.html" import initialize_datatables %}
{% block title %}Add a Group{% endblock %}
{% block header %}Add a Group{% endblock %}

{% block breadcrumbs %}
<ol class="breadcrumb">
  <li>
    <a href="{{ url_for('coprs_ns.coprs_show') }}">Home</a>
  </li>
  <li>
    <a href="{{ url_for('coprs_ns.coprs_by_user', username=g.user.name) }}">{{ g.user.name }}</a>
  </li>
  <li class="active">
    groups
  </li>
</ol>
{% endblock %}
{% block body %}

  <h1>
    {{ user.name|capitalize }}'s groups
  </h1>
  <p>
  Hint: If you miss some recently added FAS group here, try to log-out and
  log-in again.
  <p>

{% if teams %}
  <table class="datatable table table-striped table-bordered">
    <thead>
      <tr>
        <th>FAS Group</th>
        <th>Copr Group Alias</th>
      </tr>
    </thead>
    <tbody>
    {% for team in teams %}
      <tr>
        <td><a href="{{ config.GROUP_INFO.link.format(name=team) }}">
          {{ team }}
        </a></td>
        <td>
            {% if copr_groups[team] %}
                <a href="{{ url_for('groups_ns.list_projects_by_group', group_name=copr_groups[team]) }}">
                  {{ copr_groups[team] }}
                </a>
            {% else %}
                <a href="{{ url_for('groups_ns.activate_group', fas_group=team) }}">
                  <span class="pficon pficon-add-circle-o">
                    Activate this group.
                  </span>
                </a>
            {% endif %}
        </td>
      </tr>
    {% endfor %}
    </tbody>
  </table>
{% else %}
  <h3>You are not listed in any FAS group.</h3>
{% endif %}

{{ initialize_datatables() }}

{% endblock %}
