Skip to content
Snippets Groups Projects
Commit 57ac5685 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch '89-provide-page-turning-base-template' into 'master'

Use turnable template. Advances BiscuIT-ng#89.

See merge request Teckids/BiscuIT/BiscuIT-App-Chronos!18
parents 6abe2af2 a5335735
No related branches found
No related tags found
1 merge request!18Use turnable template. Advances BiscuIT-ng#89.
......@@ -6,22 +6,6 @@
{% block bootstrap4_title %}{% blocktrans %}Lessons{% endblocktrans %} - {{ block.super }}{% endblock %}
{% block page_title %}{% blocktrans %}Lessons{% endblocktrans %}{% endblock %}
{% block content %}
<div class="d-flex justify-content-between">
<div>
<h1>{{ day }}</h1>
</div>
<div class="btn-group" role="group" aria-label="Day actions">
<a href="{% url 'lessons_day_by_date' day_prev %}" class="btn btn-secondary">
{% fa 'arrow-left' %}
</a>
<a href="{% url 'lessons_day_by_date' day_next %}" class="btn btn-secondary">
{% fa 'arrow-right' %}
</a>
</div>
</div>
{% block current_content %}
{% render_table lessons_table %}
{% endblock %}
{# -*- engine:django -*- #}
{% extends "core/base.html" %}
{% extends "core/turnable.html" %}
{% load bootstrap4 data_helpers font_awesome i18n staticfiles %}
{% block bootstrap4_extra_head %}
......@@ -10,23 +10,7 @@
{% block bootstrap4_title %}{% blocktrans %}Timetable{% endblocktrans %} - {{ block.super }}{% endblock %}
{% block page_title %}{% blocktrans %}Timetable{% endblocktrans %}{% endblock %}
{% block content %}
<div class="d-flex justify-content-between">
<div>
<h1>{{ day }}</h1>
</div>
<div class="btn-group" role="group" aria-label="Day actions">
<a href="{% url 'timetable_by_week' week_prev %}?{{ request.GET.urlencode }}" class="btn btn-secondary">
{% fa 'arrow-left' %}
</a>
<a href="{% url 'timetable_by_week' week_next %}?{{ request.GET.urlencode }}" class="btn btn-secondary">
{% fa 'arrow-right' %}
</a>
</div>
</div>
{% block current_content %}
<form method="get">
<ul id="timetable_select_form">
{{ select_form.as_ul }}
......
......@@ -88,12 +88,13 @@ def timetable(request: HttpRequest, week: Optional[int] = None) -> HttpResponse:
# Add a form to filter the view
select_form = SelectForm(request.GET or None)
context['current_head'] = _('Timetable')
context['lesson_periods'] = OrderedDict(sorted(per_day.items()))
context['periods'] = TimePeriod.get_times_dict()
context['weekdays'] = dict(TimePeriod.WEEKDAY_CHOICES)
context['week'] = wanted_week
context['week_prev'] = wanted_week - 1
context['week_next'] = wanted_week + 1
context['url_prev'] = '%s?%s' % (reverse('timetable_by_week', week=wanted_week - 1), request.GET.urlencode())
context['url_next'] = '%s?%s' % (reverse('timetable_by_week', week=wanted_week + 1), request.GET.urlencode())
context['select_form'] = select_form
return render(request, 'chronos/tt_week.html', context)
......@@ -120,10 +121,11 @@ def lessons_day(request: HttpRequest, when: Optional[str] = None) -> HttpRespons
lessons_table = LessonsTable(lesson_periods.extra(select={'_week': week}).all())
RequestConfig(request).configure(lessons_table)
context['current_head'] = _('Lessons')
context['lessons_table'] = lessons_table
context['day'] = day
context['day_prev'] = day + timedelta(days=-1)
context['day_next'] = day + timedelta(days=1)
context['url_prev'] = reverse('lessons_day_by_date', day + timedalta(days=-1)
context['url_next'] = reverse('lessons_day_by_data', day + timedalta(days=+1)
context['week'] = week
context['lesson_periods'] = lesson_periods
......
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