{% extends "base.html" %}
{% load promgen %}
{% load i18n %}
{% block content %}

{% regroup url_list by project as project_list %}
{% regroup project_list by grouper.service as service_list %}

<div class="page-header">
  <h1>URLs</h1>
</div>

{% breadcrumb label='All URLs' %}

<table class="table table-bordered table-condensed">
  <tr>
    <th>URL</th>
    <th colspan="3">Module</th>
  </tr>
  {% for service in service_list %}
  {% for project in service.list %}
  <tr>
    <th colspan="4">
      <h2>
        <a href="{{service.grouper.get_absolute_url}}">
          {{ service.grouper.name }}
        </a>
        »
        <small>
          <a href="{{project.grouper.get_absolute_url}}">
            {{project.grouper.name}}
          </a>
        </small>
      </h2>
    </th>
  </tr>
  {% for url in project.list %}
  <tr>
    <td>{{url.url}}</td>
    <td>{{url.probe.module}}</td>
    <td>{{url.probe.description}}</td>
    <td class="col-md-1">
      <form method="post" action="{% url 'url-delete' url.id %}" onsubmit="return confirm('Delete this url?')" style="display: inline">
        {% csrf_token %}
        <button class="btn btn-danger btn-xs">{% trans "Delete" %}</button>
      </form>
    </td>
  </tr>
  {% endfor %}{# URL #}
  {% endfor %}{# Project #}

  {% endfor %}{# Service #}
</table>

{% endblock %}
