{% extends "mini_buildd/base.html" %}
{% block title %}{% block titledup %}{{ route|title }}{% endblock %}{% endblock %}
{% block tooltip %}{{ view.mbd_repositories|length }} repositories{% endblock %}
{% block menu %}
	<li>{% mbd_api "keyring_packages" %}</li>
	<li>{% mbd_api "test_packages" %}</li>
	<li><a href="{% url 'admin:mini_buildd_repository_changelist' %}"><img class="mbd-icon" src="{% static 'icons/categories/preferences-other.svg' %}" alt="Configure"></a></li>
{% endblock %}

{% block content %}
	{% for r in view.mbd_repositories %}
		<section>
			<header class="mbd-grid-lcr">
				<h2>{{ r }}</h2>
				<nav>
				</nav>
				<nav>
					<ul>
						{% if r.external_home_url %}
							<li><a href="{{ r.external_home_url }}" title="External doc for this repository">Manual</a></li>
						{% endif %}
						<li>{% mbd_api "sources_list" value_repositories=r.identity %}</li>
						<li>{% mbd_api "uploaders" value_repositories=r.identity %}</li>
						<li><a href="{% url 'admin:mini_buildd_repository_change' r.identity %}"><img class="mbd-icon" src="{% static 'icons/categories/preferences-other.svg' %}" alt="Configure"></a></li>
					</ul>
				</nav>
			</header>

			{% mbd_token as table_id %}
			<table id="{{ table_id }}" style="width: 100%;">
				{% mbd_datatable table_id %}
				<thead>
					<tr>
						<th>Distribution</th>
						<th>Menu</th>
					</tr>
				</thead>
				<tbody>
					{% for d in r.mbd_sorted_distributions %}
						<tr>
							<td><a href="{% url 'repositories' r.identity|add:'/dists/'|add:d.base_source.codename|add:'-'|add:r.identity|add:'-'|add:r.layout.suiteoption_set.all.first.suite.name %}">{{ d }}</a></td>
							<td>{% mbd_api "sources_list" value_repositories=r.identity value_codenames=d.base_source.codename %}</td>
						</tr>
					{% endfor %}
				</tbody>
			</table>
		</section>
	{% endfor %}
{% endblock %}
