From f4ac5f443e3fb7d50ebcfe262eaa98bbbc08bd04 Mon Sep 17 00:00:00 2001 From: Jonathan Weth <git@jonathanweth.de> Date: Sun, 12 Jan 2020 20:30:32 +0100 Subject: [PATCH] Add regular plan --- aleksis/apps/chronos/templates/chronos/lesson.html | 7 +++---- aleksis/apps/chronos/templates/chronos/plan.html | 2 +- aleksis/apps/chronos/urls.py | 1 + aleksis/apps/chronos/views.py | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/aleksis/apps/chronos/templates/chronos/lesson.html b/aleksis/apps/chronos/templates/chronos/lesson.html index f7a5771c..cfcfc6c7 100644 --- a/aleksis/apps/chronos/templates/chronos/lesson.html +++ b/aleksis/apps/chronos/templates/chronos/lesson.html @@ -18,14 +18,13 @@ {% endif %} {% endif %} " - {# Add CSS class for sub when it's a sub #} - class="{% if lesson_period.get_substitution %}{% if lesson_period.substitution.table.is_event %}lesson-with-event{% else %}lesson-with-sub{% endif %}{% endif %}" + class="{% if lesson_period.get_substitution and smart %}{% if lesson_period.substitution.table.is_event %}lesson-with-event{% else %}lesson-with-sub{% endif %}{% endif %}" > <p> - {% if lesson_period.is_hol %} + {% if lesson_period.is_hol and smart %} {# Do nothing #} - {% elif lesson_period.get_substitution %} + {% elif lesson_period.get_substitution and smart %} {% with sub=lesson_period.get_substitution %} {# SUBSTITUTION #} {% if type == "room" and lesson_period.room != lesson_period.get_room %} diff --git a/aleksis/apps/chronos/templates/chronos/plan.html b/aleksis/apps/chronos/templates/chronos/plan.html index 1d347e6f..136ccc17 100644 --- a/aleksis/apps/chronos/templates/chronos/plan.html +++ b/aleksis/apps/chronos/templates/chronos/plan.html @@ -67,7 +67,7 @@ <span class="badge new primary-color left smart-plan-badge">SMART PLAN</span> <a class="waves-effect waves-light btn-flat no-print" style="padding-left: 3px; padding-right: 3px;" - href="#{# url "timetable_regular_plan" raw_type id "regular" #}"> + href="{% url "timetable_regular" type pk "regular" %}"> <i class="material-icons left">slideshow</i> REGELPLAN ANZEIGEN </a> diff --git a/aleksis/apps/chronos/urls.py b/aleksis/apps/chronos/urls.py index ed55dca2..791a4b9c 100644 --- a/aleksis/apps/chronos/urls.py +++ b/aleksis/apps/chronos/urls.py @@ -6,6 +6,7 @@ urlpatterns = [ path("timetable/<str:_type>/<int:pk>", views.timetable, name="timetable"), path("all_timetables", views.all, name="all_timetables"), path("timetable/<str:_type>/<int:pk>/<int:year>/<int:week>", views.timetable, name="timetable_by_week"), + path("timetable/<str:_type>/<int:pk>/<str:regular>/", views.timetable, name="timetable_regular"), path("lessons", views.lessons_day, name="lessons_day"), path("lessons/<when>", views.lessons_day, name="lessons_day_by_date"), path( diff --git a/aleksis/apps/chronos/views.py b/aleksis/apps/chronos/views.py index a5f3e6aa..817eff8e 100644 --- a/aleksis/apps/chronos/views.py +++ b/aleksis/apps/chronos/views.py @@ -79,10 +79,12 @@ def all(request: HttpRequest) -> HttpResponse: @login_required def timetable( - request: HttpRequest, _type: str, pk: int, year: Optional[int] = None, week: Optional[int] = None + request: HttpRequest, _type: str, pk: int, year: Optional[int] = None, week: Optional[int] = None, regular: Optional[str] = None ) -> HttpResponse: context = {} + is_smart = regular != "regular" + if _type == "group": el = get_object_or_404(Group, pk=pk) elif _type == "teacher": @@ -154,7 +156,7 @@ def timetable( context["type"] = _type context["pk"] = pk context["el"] = el - context["smart"] = True + context["smart"] = is_smart week_prev = wanted_week - 1 week_next = wanted_week + 1 -- GitLab