From e6a5fa823eb3af242a791bd01546656748a876a1 Mon Sep 17 00:00:00 2001 From: Lloyd Meins <git@lloydmeins.de> Date: Sun, 16 May 2021 17:58:19 +0200 Subject: [PATCH] Keep colour in regular timetable and change colour on substitutions --- .../chronos/templates/chronos/partials/lesson.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/aleksis/apps/chronos/templates/chronos/partials/lesson.html b/aleksis/apps/chronos/templates/chronos/partials/lesson.html index 5b7ceb6c..523b3c62 100644 --- a/aleksis/apps/chronos/templates/chronos/partials/lesson.html +++ b/aleksis/apps/chronos/templates/chronos/partials/lesson.html @@ -1,12 +1,20 @@ {% load i18n %} <div style=" + {% with sub=lesson_period.get_substitution %} {# Display background color only if lesson is not cancelled and it is not the old room #} - {% if not lesson_period.get_substitution.cancelled and not lesson_period.get_substitution.cancelled_for_teachers %} + {% if not smart %} + {% include "chronos/partials/subject_colour.html" with subject=lesson_period.lesson.subject %} + {% elif not sub.cancelled and not lesson_period.get_substitution.cancelled_for_teachers %} {% if not type.value == "room" or lesson_period.room == lesson_period.get_room or lesson_period.get_room == el %} - {% include "chronos/partials/subject_colour.html" with subject=lesson_period.lesson.subject %} + {% if sub and sub.subject %} + {% include "chronos/partials/subject_colour.html" with subject=sub.subject %} + {% else %} + {% include "chronos/partials/subject_colour.html" with subject=lesson_period.lesson.subject %} + {% endif %} {% endif %} {% endif %} + {% endwith %} " {# Add CSS class for sub when it's a sub #} class="{% if lesson_period.get_substitution and smart %}lesson-with-sub{% endif %}" -- GitLab