From fb3a3bc214b071083325a75a9546331150eaa8a5 Mon Sep 17 00:00:00 2001
From: Alban Gruin
Date: Wed, 25 Apr 2018 09:35:18 +0200
Subject: templates: abstraction des listes de groupes/salles/semaines

---
 templates/group_list.html | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

(limited to 'templates/group_list.html')

diff --git a/templates/group_list.html b/templates/group_list.html
index 9c9a7fc..bca8c70 100644
--- a/templates/group_list.html
+++ b/templates/group_list.html
@@ -1,19 +1,16 @@
 {% extends "index.html" %}
 {% load dt_week %}
 
-{% block title %}{% if timetable %}{{ timetable }}{% else %}Emploi du temps des salles{% endif %} – {% endblock %}
+{% block title %}{{ timetable }} – {% endblock %}
+{% block pagetitle %}<a href="{{ timetable.source.url }}">{{ timetable }}</a>{% endblock %}
 
-{% block body %}
-      <h3>{% if timetable %}<a href="{{ timetable.source.url }}">{{ timetable }}</a>{% else %}Emploi du temps des salles{% endif %}</h3>
-      <ul>
-        {% for group in groups %}
-        <li><a class="text"{% if group.weeks is not None %} href="{% if timetable %}{% url "timetable" timetable.year.slug timetable.slug group.slug %}{% else %}{% url "room-timetable" group.slug %}{% endif %}"{% endif %}>{{ group }}</a> &mdash; {% for week in group.weeks %}<a href="{% if timetable %}{% url "timetable" timetable.year.slug timetable.slug group.slug week.year week|dt_week %}{% else %}{% url "room-timetable" group.slug week.year week|dt_week %}{% endif %}">{{ week|dt_prettyprint }}</a> {% if not forloop.last %}&ndash; {% endif %}{% empty %}<em>aucun cours dans le mois à venir</em>{% endfor %}</li>
-        {% endfor %}
-      </ul>
-      {% if timetable %}
-        <a href="{% url "mentions" timetable.year.slug %}">Retour à la liste des mentions</a> &ndash;
-        <a href="{% url "groups-all" timetable.year.slug timetable.slug %}">Tous les groupes</a>
-      {% else %}
-        <a href="{% url "index" %}">Retour à la liste des années</a>
-      {% endif %}
+{% block lelement %}<a class="text"{% if element.weeks is not None %} href="{% block gurl %}{% url "timetable" timetable.year.slug timetable.slug element.slug %}{% endblock %}"{% endif %}>{{ element }}</a> &mdash;
+{% for week in element.weeks %}
+  <a href="{% block wurl %}{% url "timetable" timetable.year.slug timetable.slug element.slug week.year week|dt_week %}{% endblock %}">{{ week|dt_prettyprint }}</a> {% if not forloop.last %}&ndash; {% endif %}
+{% empty %}
+  <em>aucun cours dans le mois à venir</em>
+{% endfor %}
 {% endblock %}
+
+{% block navigation %}<a href="{% url "mentions" timetable.year.slug %}">Retour à la liste des mentions</a> &ndash;
+<a href="{% url "groups-all" timetable.year.slug timetable.slug %}">Tous les groupes</a>{% endblock %}
-- 
cgit v1.2.1