From 1d5068de5e4babb8c2c969c626fd1d8b53bc28ea Mon Sep 17 00:00:00 2001
From: Alban Gruin
Date: Thu, 28 Sep 2017 22:27:50 +0200
Subject: Mise en commun de la template de sélection de l’année et de la
 mention

---
 templates/group_list.html   |  4 ++--
 templates/index.html        | 14 +++++++-------
 templates/mention_list.html | 14 --------------
 templates/timetable.html    |  8 ++++----
 4 files changed, 13 insertions(+), 27 deletions(-)
 delete mode 100644 templates/mention_list.html

(limited to 'templates')

diff --git a/templates/group_list.html b/templates/group_list.html
index eeb3a35..aebb0db 100644
--- a/templates/group_list.html
+++ b/templates/group_list.html
@@ -6,8 +6,8 @@
 {% block body %}
       <h3><a href="{{ timetable.url }}">{{ timetable }}</a></h3>
       <ul>
-	{% for group in groups %}
+        {% for group in groups %}
         <li><a class="text"{% if group.weeks is not None %} href="{% url "timetable" timetable.year.slug timetable.slug group.slug %}"{% endif %}>{{ group }}</a> &ndash; {% for week in group.weeks %}<a href="{% url "timetable" timetable.year.slug timetable.slug group.slug week.year week|dt_week %}">{{ week|dt_prettyprint }}</a> {% empty %}<em>aucun cours</em>{% endfor %}</li>
-	{% endfor %}
+        {% endfor %}
       </ul>
 {% endblock %}
diff --git a/templates/index.html b/templates/index.html
index efbb21c..8d7634e 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -3,7 +3,7 @@
   <head>
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1" />
-    <title>{% block title %}{% endblock %}celcatsanitizer</title>
+    <title>{% block title %}{% if year %}{{ year }} &ndash; {% endif %}{% endblock %}celcatsanitizer</title>
     <link rel="stylesheet" href="{% static "celcatsanitizer/style.css" %}">
   </head>
   <body>
@@ -12,13 +12,13 @@
     </header>
     <div class="content">
       {% block body %}
-      <h3>Choisissez votre année</h3>
+      <h3>{% if year %}{{ year }} &ndash; Choisissez votre mention{% else %}Choisissez votre année{% endif %}</h3>
       <ul>
-	{% for year in years %}
-	<li><a href="{% url "mentions" year.slug %}">{{ year }}</a></li>
-	{% empty %}
-	<p><em>Aucun emploi du temps à afficher</em></p>
-	{% endfor %}
+        {% for element in elements %}
+        <li><a href="{% if year %}{% url "groups" year.slug element.slug %}{% else %}{% url "mentions" element.slug %}{% endif %}">{{ element }}</a></li>
+        {% empty %}
+        <p><em>Aucun emploi du temps à afficher</em></p>
+        {% endfor %}
       </ul>
       {% endblock %}
     </div>
diff --git a/templates/mention_list.html b/templates/mention_list.html
deleted file mode 100644
index 71cfaac..0000000
--- a/templates/mention_list.html
+++ /dev/null
@@ -1,14 +0,0 @@
-{% extends "index.html" %}
-
-{% block title %}{{ year }} &ndash; {% endblock %}
-
-{% block body %}
-      <h3>{{ year }} &ndash; Choisissez votre mention</h3>
-      <ul>
-{% for timetable in timetables %}
-        <li><a href="{% url "groups" year.slug timetable.slug %}">{{ timetable }}</a></li>
-{% empty %}
-        <p>Aucun emploi du temps à afficher</p>
-{% endfor %}
-      </ul>
-{% endblock %}
diff --git a/templates/timetable.html b/templates/timetable.html
index 21afa24..9143c2f 100644
--- a/templates/timetable.html
+++ b/templates/timetable.html
@@ -5,10 +5,10 @@
 {% block body %}
       <h2>{{ group.timetable }} &ndash; {{ group }} &ndash; Semaine {{ week }}</h2>
       <p>
-	{% if is_old_timetable %}
-	<b><a href="{% url "timetable" group.timetable.year.slug group.timetable.slug group.slug %}">Accéder à l’emploi du temps de cette semaine.</b></a><br />
-	{% endif %}
-	Dernière mise à jour le {{ last_update|date:"l j F o" }} à {{ last_update|date:"H:i" }}
+        {% if is_old_timetable %}
+        <b><a href="{% url "timetable" group.timetable.year.slug group.timetable.slug group.slug %}">Accéder à l’emploi du temps de cette semaine.</b></a><br />
+        {% endif %}
+        Dernière mise à jour le {{ last_update|date:"l j F o" }} à {{ last_update|date:"H:i" }}
       </p>
       {% include "timetable_common.html" %}
       <p class="subscribe"><a href="{% url "ics" group.timetable.year.slug group.timetable.slug group.slug %}">ICS</a> &ndash; <a href="{% url "rss" group.timetable.year.slug group.timetable.slug group.slug %}">RSS</a> &ndash; <a href="{% url "atom" group.timetable.year.slug group.timetable.slug group.slug %}">Atom</a></p>{% endblock %}
-- 
cgit v1.2.1