{% extends "master.html" %}

{% block title %}Mirrors{% endblock %}
{%block tag %}mirrors{% endblock %}

{% block content %}
<h2>Public active mirrors</h2>

{% if request.view_args.p_name %}
<p>
  These are the mirrors for {{ request.view_args.p_name }}
  {{ request.view_args.p_version }}
  {% if request.view_args.p_arch %}on {{ request.view_args.p_arch }}{% endif %}
</p>
{% endif %}

{% if mirrors %}
<p>
  We have currently {{ mirrors | length }} active mirrors
</p>

<table class="table table-striped">
  <tr>
    <th>Country</th>
    <th>Site Name</th>
    <th>Mirror Name</th>
    <th>Categories</th>
    <th>Bandwith</th>
    <th>Internet2</th>
    <th>Comment</th>
  </tr>
  {% for mirror in mirrors %}
  <tr>
    <td>{{ mirror.country }}</td>
    <td>
      <a href="{{ mirror.site.org_url }}">
        {{ mirror.site.name }}
      </a>
    </td>
    <td>{{ mirror.name }}</td>
    <td>
      <ul class="list-unstyled">
      {% for cat in mirror.categories %}
        {% if cat.urls %}
          <li>
          {{ cat.category.name }}
          {% for url in cat.urls %}
            <a href="{{ url.url }}">{{ url.url.split('://')[0] }}</a>
          {% endfor %}
          </li>
        {% endif %}
      {% endfor %}
      </ul>
    </td>
    <td>{{ mirror.bandwidth_int }}</td>
    <td>{% if mirror.internet2 %}Yes{% else %}No{% endif %}</td>
    <td>{% if mirror.comment %}{{ mirror.comment }}{% endif %}</td>
  </tr>
  {% endfor %}
</table>
{% else %}
<p>
  There are currently no active mirrors registered.
</p>
{% endif %}

{% endblock %}
