diff --git a/aleksis/apps/chronos/templates/chronos/timetable.html b/aleksis/apps/chronos/templates/chronos/timetable.html index 4fa91ac68f3ef7c34678ae9c94958f324ca43380..b017b2dccf3b88074e153bedae79bb27164c25ea 100644 --- a/aleksis/apps/chronos/templates/chronos/timetable.html +++ b/aleksis/apps/chronos/templates/chronos/timetable.html @@ -124,13 +124,14 @@ </div> {# Show short weekdays on tablets #} - {% for day in weekdays_short.items %} + {% for i, day in weekdays_short.items %} <div class="col s2 hide-on-large-only"> <div class="card timetable-title-card"> <div class="card-content"> <span class="card-title"> - {{ day.1 }} + {{ day.0 }} </span> + {{ day.1 }} {# {% if day.1 %}#} {# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#} {# {% endif %}#} @@ -140,13 +141,14 @@ {% endfor %} {# Show long weekdays elsewere #} - {% for day in weekdays.items %} + {% for i, day in weekdays.items %} <div class="col s2 hide-on-med-only"> <div class="card timetable-title-card"> <div class="card-content"> <span class="card-title"> - {{ day.1 }} + {{ day.0 }} </span> + {{ day.1 }} {# {% if day.1 %}#} {# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#} {# {% endif %}#} @@ -176,12 +178,13 @@ {# show 5 seperate ones on mobiles #} <div class="timetable-plan hide-on-med-and-up"> - {% for day in weekdays.items %} + {% for i, day in weekdays.items %} <div class="card timetable-mobile-title-card"> <div class="card-content"> <span class="card-title"> - {{ day.1 }} + {{ day.0 }} </span> + {{ day.1 }} {# {% if day.1 %}#} {# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#} {# {% endif %}#} @@ -195,7 +198,7 @@ </div> {% for weekday, lessons in lesson_periods_period.items %} - {% if forloop.counter0|add:"1" == day.0 %} + {% if forloop.counter0 == i %} <div class="col s8"> {# A lesson #} {% include "chronos/partials/lesson.html" with lessons=lessons %} diff --git a/aleksis/apps/chronos/views.py b/aleksis/apps/chronos/views.py index daad66d7c699cfd95d711ad9faa2760274fe8049..21de994ed95f3b6266b71d8cfc19b41ad3dbfb40 100644 --- a/aleksis/apps/chronos/views.py +++ b/aleksis/apps/chronos/views.py @@ -151,10 +151,20 @@ def timetable( context["lesson_periods"] = OrderedDict(sorted(per_period.items())) context["periods"] = TimePeriod.get_times_dict() context["weekdays"] = dict( - TimePeriod.WEEKDAY_CHOICES[TimePeriod.weekday_min : TimePeriod.weekday_max + 1] + [ + (key, (item, wanted_week[key])) + for key, item in TimePeriod.WEEKDAY_CHOICES[ + TimePeriod.weekday_min : TimePeriod.weekday_max + 1 + ] + ] ) context["weekdays_short"] = dict( - TimePeriod.WEEKDAY_CHOICES_SHORT[TimePeriod.weekday_min : TimePeriod.weekday_max + 1] + [ + (key, (item, wanted_week[key])) + for key, item in TimePeriod.WEEKDAY_CHOICES_SHORT[ + TimePeriod.weekday_min : TimePeriod.weekday_max + 1 + ] + ] ) context["weeks"] = get_weeks_for_year(year=wanted_week.year) context["week"] = wanted_week