From 29b3ab58db2f9a4f2a4401af4947f9679cd1fa86 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Thu, 28 Jan 2016 16:03:58 +0100 Subject: [PATCH] minimum list size to use letter initials --- src/catalogue/templates/catalogue/catalogue.html | 2 +- src/catalogue/templates/catalogue/collections.html | 2 +- src/catalogue/templatetags/catalogue_tags.py | 3 +++ src/wolnelektury/locale-contrib/pl/LC_MESSAGES/django.po | 4 ++-- src/wolnelektury/settings/custom.py | 2 ++ 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/catalogue/templates/catalogue/catalogue.html b/src/catalogue/templates/catalogue/catalogue.html index f1b97f43f..1fc8b7b3d 100644 --- a/src/catalogue/templates/catalogue/catalogue.html +++ b/src/catalogue/templates/catalogue/catalogue.html @@ -21,7 +21,7 @@ {% plain_list books by_author=True paged=False initial_blocks=True %}

{% trans "Collections" %}

- {% plain_list collections paged=False with_initials=False %} + {% plain_list collections paged=False %}

{% trans "Gallery" %}

{% plain_list pictures by_author=True paged=False initial_blocks=True %} diff --git a/src/catalogue/templates/catalogue/collections.html b/src/catalogue/templates/catalogue/collections.html index 26d67f173..1c6987278 100644 --- a/src/catalogue/templates/catalogue/collections.html +++ b/src/catalogue/templates/catalogue/collections.html @@ -15,7 +15,7 @@ {% endfor %}

{% trans "All collections" %}

- {% plain_list objects with_initials=False %} + {% plain_list objects %} diff --git a/src/catalogue/templatetags/catalogue_tags.py b/src/catalogue/templatetags/catalogue_tags.py index d5e7e059f..23eeedacc 100644 --- a/src/catalogue/templatetags/catalogue_tags.py +++ b/src/catalogue/templatetags/catalogue_tags.py @@ -359,6 +359,9 @@ def plain_list(context, object_list, with_initials=True, by_author=False, choice paged=True, initial_blocks=False): names = [('', [])] last_initial = None + if len(object_list) < settings.CATALOGUE_MIN_INITIALS and not by_author: + with_initials = False + initial_blocks = False for obj in object_list: if with_initials: if by_author: diff --git a/src/wolnelektury/locale-contrib/pl/LC_MESSAGES/django.po b/src/wolnelektury/locale-contrib/pl/LC_MESSAGES/django.po index 53cdb9874..17c1e9cb7 100644 --- a/src/wolnelektury/locale-contrib/pl/LC_MESSAGES/django.po +++ b/src/wolnelektury/locale-contrib/pl/LC_MESSAGES/django.po @@ -507,8 +507,8 @@ msgid "" "Forgotten your password? Enter your e-mail address below, and we'll send " "you an e-mail allowing you to reset it." msgstr "" -"Nie pamiętasz swojego hasła? Wpisz adres e-mail, a wyślemy Ci e-mail " -"umożliwiający zresetowanie go." +"Nie pamiętasz swojego hasła? Wpisz adres e-mail, a wyślemy Ci wiadomość " +"umożliwiającą zresetowanie go." #: /home/janek/.virtualenvs/lektury/local/lib/python2.7/site-packages/allauth/templates/account/password_reset.html:20 msgid "Reset My Password" diff --git a/src/wolnelektury/settings/custom.py b/src/wolnelektury/settings/custom.py index 688573270..09cc641e6 100644 --- a/src/wolnelektury/settings/custom.py +++ b/src/wolnelektury/settings/custom.py @@ -24,3 +24,5 @@ LIBRARIAN_PDF_MOREFLOATS = None LATEST_BLOG_POSTS = "http://nowoczesnapolska.org.pl/feed/?cat=-135" CATALOGUE_COUNTERS_FILE = os.path.join(VAR_DIR, 'catalogue_counters.p') + +CATALOGUE_MIN_INITIALS = 60 -- 2.20.1