Skip to content
Snippets Groups Projects
Verified Commit 067bcbb3 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Create an easier structure for connection of weekdays and corresponding dates for templates

parent 2dbfdc76
No related branches found
No related tags found
1 merge request!43Show dates in column headings in weekly timetable view
...@@ -124,14 +124,14 @@ ...@@ -124,14 +124,14 @@
</div> </div>
{# Show short weekdays on tablets #} {# Show short weekdays on tablets #}
{% for i, day in weekdays_short.items %} {% for i, weekday, date in weekdays_short %}
<div class="col s2 hide-on-large-only"> <div class="col s2 hide-on-large-only">
<div class="card timetable-title-card"> <div class="card timetable-title-card">
<div class="card-content"> <div class="card-content">
<span class="card-title"> <span class="card-title">
{{ day.0 }} {{ weekday }}
</span> </span>
{{ day.1 }} {{ date }}
{# {% if day.1 %}#} {# {% if day.1 %}#}
{# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#} {# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#}
{# {% endif %}#} {# {% endif %}#}
...@@ -141,14 +141,14 @@ ...@@ -141,14 +141,14 @@
{% endfor %} {% endfor %}
{# Show long weekdays elsewere #} {# Show long weekdays elsewere #}
{% for i, day in weekdays.items %} {% for i, weekday, date in weekdays %}
<div class="col s2 hide-on-med-only"> <div class="col s2 hide-on-med-only">
<div class="card timetable-title-card"> <div class="card timetable-title-card">
<div class="card-content"> <div class="card-content">
<span class="card-title"> <span class="card-title">
{{ day.0 }} {{ weekday }}
</span> </span>
{{ day.1 }} {{ date }}
{# {% if day.1 %}#} {# {% if day.1 %}#}
{# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#} {# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#}
{# {% endif %}#} {# {% endif %}#}
...@@ -178,13 +178,13 @@ ...@@ -178,13 +178,13 @@
{# show 5 seperate ones on mobiles #} {# show 5 seperate ones on mobiles #}
<div class="timetable-plan hide-on-med-and-up"> <div class="timetable-plan hide-on-med-and-up">
{% for i, day in weekdays.items %} {% for i, weekday, date in weekdays %}
<div class="card timetable-mobile-title-card"> <div class="card timetable-mobile-title-card">
<div class="card-content"> <div class="card-content">
<span class="card-title"> <span class="card-title">
{{ day.0 }} {{ weekday }}
</span> </span>
{{ day.1 }} {{ date }}
{# {% if day.1 %}#} {# {% if day.1 %}#}
{# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#} {# <span class="badge new blue center-align holiday-badge">{{ day.1.0 }}</span>#}
{# {% endif %}#} {# {% endif %}#}
......
...@@ -150,22 +150,21 @@ def timetable( ...@@ -150,22 +150,21 @@ def timetable(
context["lesson_periods"] = OrderedDict(sorted(per_period.items())) context["lesson_periods"] = OrderedDict(sorted(per_period.items()))
context["periods"] = TimePeriod.get_times_dict() context["periods"] = TimePeriod.get_times_dict()
context["weekdays"] = dict(
[ # Build lists with weekdays and corresponding dates (long and short variant)
(key, (item, wanted_week[key])) context["weekdays"] = [
for key, item in TimePeriod.WEEKDAY_CHOICES[ (key, weekday, wanted_week[key])
TimePeriod.weekday_min : TimePeriod.weekday_max + 1 for key, weekday in TimePeriod.WEEKDAY_CHOICES[
] TimePeriod.weekday_min : TimePeriod.weekday_max + 1
] ]
) ]
context["weekdays_short"] = dict( context["weekdays_short"] = [
[ (key, weekday, wanted_week[key])
(key, (item, wanted_week[key])) for key, weekday in TimePeriod.WEEKDAY_CHOICES_SHORT[
for key, item in TimePeriod.WEEKDAY_CHOICES_SHORT[ TimePeriod.weekday_min : TimePeriod.weekday_max + 1
TimePeriod.weekday_min : TimePeriod.weekday_max + 1
]
] ]
) ]
context["weeks"] = get_weeks_for_year(year=wanted_week.year) context["weeks"] = get_weeks_for_year(year=wanted_week.year)
context["week"] = wanted_week context["week"] = wanted_week
context["type"] = type_ context["type"] = type_
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment