From a8aa8e2edac5f5949d6bd80716012daad25cd044 Mon Sep 17 00:00:00 2001 From: HanseGucker <joniweth@gmx.de> Date: Sat, 2 Mar 2019 11:35:41 +0100 Subject: [PATCH] Add links in timetable (without substitutions) (issue #129) --- .../chronos/templates/timetable/lesson.html | 24 +++++++++++++++---- biscuit/apps/chronos/urls.py | 1 + 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/biscuit/apps/chronos/templates/timetable/lesson.html b/biscuit/apps/chronos/templates/timetable/lesson.html index 29047446..f8f21703 100644 --- a/biscuit/apps/chronos/templates/timetable/lesson.html +++ b/biscuit/apps/chronos/templates/timetable/lesson.html @@ -26,7 +26,8 @@ {# Class or room > Display teacher #} {% if type == 2 or type == 1 %} <span data-position="bottom" class="tooltipped" - data-tooltip="{{ element_container.element.teacher }}">{{ element_container.element.teacher.shortcode }}</span> + data-tooltip="{{ element_container.element.teacher }}"><a + href="{% url "timetable_plan" "teacher" element_container.element.teacher.id %}">{{ element_container.element.teacher.shortcode }}</a></span> <br> {% endif %} @@ -70,13 +71,22 @@ {# Teacher or room > Display classes #} {% if type == 0 or type == 1 %} - {{ element_container.classes_formatted }} + {# {{ element_container.element.classes }}#} + {% if element_container.element.classes %} + <a href="{% url "timetable_plan" "class" element_container.element.classes.0.id %}"> + {{ element_container.classes_formatted }} + </a> + {% endif %} {% endif %} {# Class or room > Display teacher #} {% if type == 2 or type == 1 %} <span data-position="bottom" class="tooltipped" - data-tooltip="{{ element_container.element.teacher }}">{{ element_container.element.teacher.shortcode }}</span> + data-tooltip="{{ element_container.element.teacher }}"> + <a href="{% url "timetable_plan" "teacher" element_container.element.teacher.id %}"> + {{ element_container.element.teacher.shortcode }} + </a> + </span> {% endif %} {# Display subject #} @@ -85,7 +95,13 @@ {# Teacher or class > Display room #} {% if type == 0 or type == 2 %} <span class="tooltipped" data-position="bottom" - data-tooltip="{{ element_container.room.name }}">{{ element_container.room.shortcode }}</span> + data-tooltip="{{ element_container.room.name }}"> + {% if element_container.room %} + <a href="{% url "timetable_plan" "room" element_container.room.id %}"> + {{ element_container.room.shortcode }} + </a> + {% endif %} + </span> {% endif %} {% endif %} </p> diff --git a/biscuit/apps/chronos/urls.py b/biscuit/apps/chronos/urls.py index 8c6ad77e..a01d1e1b 100755 --- a/biscuit/apps/chronos/urls.py +++ b/biscuit/apps/chronos/urls.py @@ -6,6 +6,7 @@ urlpatterns = [ path('my', views.my_plan, name='timetable_my_plan'), path('my/<int:year>/<int:month>/<int:day>/', views.my_plan, name='timetable_my_plan'), path('quick/', views.quicklaunch, name='timetable_quicklaunch'), + # plan_type = ["teacher", "class", "room"] path('<str:plan_type>/<int:plan_id>', views.plan, name='timetable_plan'), path('<str:plan_type>/<int:plan_id>/<str:smart>', views.plan, name='timetable_smart_plan'), path('<str:plan_type>/<int:plan_id>/<str:smart>/<int:year>/<int:calendar_week>', views.plan, -- GitLab