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 +++++++++++-------------- templates/index.html | 2 +- templates/room_list.html | 9 +++++++++ views.py | 6 +++--- 4 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 templates/room_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 %}{{ timetable }}{% endblock %} -{% block body %} -
{% block empty %}Aucun emploi du temps à afficher{% endblock %}
{% endfor %} diff --git a/templates/room_list.html b/templates/room_list.html new file mode 100644 index 0000000..1b8497d --- /dev/null +++ b/templates/room_list.html @@ -0,0 +1,9 @@ +{% extends "group_list.html" %} +{% load dt_week %} + +{% block title %}Emploi du temps des salles – {% endblock %} +{% block pagetitle %}Emploi du temps des salles{% endblock %} +{% block gurl %}{% url "room-timetable" element.slug %}{% endblock %} +{% block wurl %}{% url "room-timetable" element.slug week.year week|dt_week %}{% endblock %} +{% block navigation %}Retour à la liste des années – +Trouver une salle libre{% endblock %} diff --git a/views.py b/views.py index 2411fe7..e45ece3 100644 --- a/views.py +++ b/views.py @@ -76,7 +76,7 @@ def group_list(request, year_slug, timetable_slug): group.weeks.sort() return render(request, "group_list.html", - {"timetable": timetable, "groups": groups}) + {"timetable": timetable, "elements": groups}) def groups_all(request, year_slug, timetable_slug): @@ -199,7 +199,7 @@ def rooms(request): RawSQL("date_trunc('week', edt_course.begin)", []), distinct=True)) - return render(request, "group_list.html", {"groups": rooms}) + return render(request, "room_list.html", {"elements": rooms}) # Récupération des salles et de toutes les semaines où elles sont # concernées. @@ -232,7 +232,7 @@ def rooms(request): rooms_weeks[-1].weeks.append(date) # Rendu de la page. - return render(request, "group_list.html", {"groups": rooms_weeks}) + return render(request, "room_list.html", {"elements": rooms_weeks}) def room_weeks(request, room_slug): -- cgit v1.2.1