From 4d40d1dc355776bb02fe0c622aa52cc3f396673c Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Thu, 11 Feb 2016 17:00:48 +0100 Subject: [PATCH] zaznaczanie pozycji w menu --- .../catalogue/tagged_object_list.html | 2 +- src/catalogue/templatetags/catalogue_tags.py | 6 +++--- src/catalogue/views.py | 7 +++++-- src/wolnelektury/static/scss/main/menu.scss | 4 ++++ src/wolnelektury/templates/superbase.html | 20 ++++++++++++++----- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/catalogue/templates/catalogue/tagged_object_list.html b/src/catalogue/templates/catalogue/tagged_object_list.html index 06947e3a7..b8eea9c7f 100644 --- a/src/catalogue/templates/catalogue/tagged_object_list.html +++ b/src/catalogue/templates/catalogue/tagged_object_list.html @@ -46,7 +46,7 @@ {% endif %} -{% if list_type == 'default' and not tags %} +{% if list_type == 'books' and not tags %}

{% trans "Recent publications" %}

{% for book in last_published %} diff --git a/src/catalogue/templatetags/catalogue_tags.py b/src/catalogue/templatetags/catalogue_tags.py index 105306e19..947fbf261 100644 --- a/src/catalogue/templatetags/catalogue_tags.py +++ b/src/catalogue/templatetags/catalogue_tags.py @@ -302,7 +302,7 @@ class CatalogueURLNode(Node): # @register.inclusion_tag('catalogue/tag_list.html') -def tag_list(tags, choices=None, category=None, list_type='default'): +def tag_list(tags, choices=None, category=None, list_type='books'): # print(tags, choices, category) if choices is None: choices = [] @@ -339,7 +339,7 @@ def tag_list(tags, choices=None, category=None, list_type='default'): @register.inclusion_tag('catalogue/inline_tag_list.html') -def inline_tag_list(tags, choices=None, category=None, list_type='default'): +def inline_tag_list(tags, choices=None, category=None, list_type='books'): return tag_list(tags, choices, category, list_type) @@ -363,7 +363,7 @@ def work_list(context, object_list): @register.inclusion_tag('catalogue/plain_list.html', takes_context=True) -def plain_list(context, object_list, with_initials=True, by_author=False, choice=None, book=None, list_type='default', +def plain_list(context, object_list, with_initials=True, by_author=False, choice=None, book=None, list_type='books', paged=True, initial_blocks=False): names = [('', [])] last_initial = None diff --git a/src/catalogue/views.py b/src/catalogue/views.py index 47706240c..b39bb8715 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -38,6 +38,7 @@ def catalogue(request): 'books': Book.objects.filter(parent=None).order_by('sort_key_author', 'sort_key'), 'pictures': Picture.objects.order_by('sort_key_author', 'sort_key'), 'collections': Collection.objects.all(), + 'active_menu_item': 'all_works', }) @@ -107,7 +108,7 @@ def differentiate_tags(request, tags, ambiguous_slugs): # TODO: Rewrite this hellish piece of code which tries to do everything -def tagged_object_list(request, tags='', list_type='default'): +def tagged_object_list(request, tags='', list_type='books'): raw_tags = tags # preliminary tests and conditions gallery = list_type == 'gallery' @@ -233,7 +234,7 @@ def tagged_object_list(request, tags='', list_type='default'): return redirect('tagged_object_list_gallery', raw_tags) # this is becoming more and more hacky - if list_type == 'default' and not tags: + if list_type == 'books' and not tags: last_published = Book.objects.exclude(cover_thumb='').filter(parent=None).order_by('-created_at')[:20] else: last_published = None @@ -253,6 +254,7 @@ def tagged_object_list(request, tags='', list_type='default'): 'list_type': list_type, 'daisy': daisy, 'last_published': last_published, + 'active_menu_item': 'theme' if theme_is_set else list_type, }, context_instance=RequestContext(request)) @@ -759,6 +761,7 @@ def tag_catalogue(request, category): 'best': best, 'title': constants.CATEGORIES_NAME_PLURAL[category], 'whole_category': constants.WHOLE_CATEGORY[category], + 'active_menu_item': 'theme' if category == 'theme' else None, }) diff --git a/src/wolnelektury/static/scss/main/menu.scss b/src/wolnelektury/static/scss/main/menu.scss index c2f708a0e..daede5c8f 100755 --- a/src/wolnelektury/static/scss/main/menu.scss +++ b/src/wolnelektury/static/scss/main/menu.scss @@ -129,6 +129,10 @@ body.menu-on { display: inline-block; @include size(width, 20%); + &.active { + background-color: white; + } + a { text-align: center; display: block; diff --git a/src/wolnelektury/templates/superbase.html b/src/wolnelektury/templates/superbase.html index fde574b1c..f8be8a74a 100644 --- a/src/wolnelektury/templates/superbase.html +++ b/src/wolnelektury/templates/superbase.html @@ -97,11 +97,21 @@ -- 2.20.1