From 3017f6ff905303f7d664d6da40c471c2d86381e3 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 7 Aug 2013 13:37:17 +0200 Subject: [PATCH 1/1] Project list on project page. --- catalogue/templates/catalogue/snippets/lesson_nav.html | 4 ++++ catalogue/templatetags/catalogue_tags.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/catalogue/templates/catalogue/snippets/lesson_nav.html b/catalogue/templates/catalogue/snippets/lesson_nav.html index fa9d8ad..4e36e22 100755 --- a/catalogue/templates/catalogue/snippets/lesson_nav.html +++ b/catalogue/templates/catalogue/snippets/lesson_nav.html @@ -3,6 +3,8 @@ {{ root }} {% elif lesson.type == 'synthetic' %} Lekcje syntetyczne ze wszystkich tematów +{% elif lesson.type == 'project' %} + Projekty ze wszystkich tematów {% else %} Inne {% endif %} @@ -23,6 +25,7 @@ {% endfor %} +{% if link_other_level %} {% with other=lesson.get_other_level %} {% if other %}

Ten temat jest dostępny również na @@ -30,3 +33,4 @@ {% if other.slug == 'liceum' %}zaawansowanym{% else %}podstawowym{% endif %}.

{% endif %} {% endwith %} +{% endif %} diff --git a/catalogue/templatetags/catalogue_tags.py b/catalogue/templatetags/catalogue_tags.py index 4485e18..a8d69e6 100755 --- a/catalogue/templatetags/catalogue_tags.py +++ b/catalogue/templatetags/catalogue_tags.py @@ -49,14 +49,15 @@ def section_box(section): @register.inclusion_tag("catalogue/snippets/lesson_nav.html") def lesson_nav(lesson): - if lesson.type in ('course', 'project'): + if lesson.type == 'course': root = lesson.section siblings = Lesson.objects.filter(type='course', level=lesson.level, section=root) mark_level = False + link_other_level = True else: root = None siblings = Lesson.objects.filter(type=lesson.type) - mark_level = True + mark_level = link_other_level = lesson.type == 'course' return { "lesson": lesson, "root": root, -- 2.20.1