]> git.ipfire.org Git - ipfire.org.git/blobdiff - src/templates/mirrors/index.html
mirrors: Divide list by country
[ipfire.org.git] / src / templates / mirrors / index.html
index 5ff7169dadcd52e93439184c4ef6a55e4cfc3222..ad358c70eefa3d98d1f025aa1d22ea66f8e04f4f 100644 (file)
@@ -3,22 +3,43 @@
 {% block title %}{{ _("Mirrors") }}{% end block %}
 
 {% block content %}
+       {% set total = sum((len(m) for c, m in mirrors.items())) %}
+
+       <h4 class="my-5 text-muted text-center">
+               {{ _("We are currently running %s mirror servers") % total }}
+       </h4>
+
+       {% set countries = sorted(mirrors, key=lambda c: c.name) %}
+
        <div class="row justify-content-center">
                <div class="col-12 col-md-6">
-                       <div class="list-group">
-                               {% for m in mirrors %}
-                                       <a href="/mirrors/{{ m.hostname }}" class="list-group-item list-group-item-action
-                                                       list-group-item-{% if m.state == "UP" %}success{% elif m.state == "DOWN" %}danger{% else %}warning{% end %}
-                                                       flex-column align-items-start">
-                                               <h5 class="mb-1">{{ m.hostname }}</h5>
-
-                                               <p class="mb-0 text-truncate text-muted">
-                                                       <span class="flag-icon flag-icon-{{ m.country_code.lower() }} small mr-1"></span> {{ m.country_name }}
-                                                       {% if m.owner %}&dash; {{ m.owner }}{% end %}                                                   
-                                               </p>
-                                       </a>
-                               {% end %}
-                       </div>
+                       {% for country in countries %}
+                               <a name="{{ country.alpha2 }}"></a>
+                               <div class="my-4 d-flex justify-content-between ">
+                                       <div>
+                                               <h4 class="mb-0">{{ country.name }}</h4>
+                                               <span class="small text-muted">
+                                                       {{ _("One Mirror", "%(num)s Mirrors", len(mirrors[country])) % { "num" : len(mirrors[country]) } }}
+                                               </span>
+                                       </div>
+
+                                       <h4 class="flag-icon flag-icon-{{ country.alpha2.lower() }}"></h4>
+                               </div>
+
+                               <div class="list-group">
+                                       {% for m in mirrors[country] %}
+                                               <a href="/mirrors/{{ m.hostname }}" class="list-group-item list-group-item-action
+                                                               list-group-item-{% if m.state == "UP" %}success{% elif m.state == "DOWN" %}danger{% else %}warning{% end %}
+                                                               flex-column align-items-start">
+                                                       <h5 class="mb-1">{{ m.hostname }}</h5>
+
+                                                       {% if m.owner %}
+                                                               <p class="mb-0 text-truncate text-muted">{{ m.owner }}</p>
+                                                       {% end %}
+                                               </a>
+                                       {% end %}
+                               </div>
+                       {% end %}
                </div>
        </div>
 {% end block %}