From 97d7b46edcc444cacafc2e4824618bfc322339c0 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 6 Jul 2010 13:29:43 +0200 Subject: [PATCH] Fixed #724: nicer search results --- apps/catalogue/templatetags/catalogue_tags.py | 9 ++++++++- apps/catalogue/views.py | 2 +- wolnelektury/static/css/master.css | 8 ++++++++ .../templates/catalogue/search_multiple_hits.html | 12 +++++++++--- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/apps/catalogue/templatetags/catalogue_tags.py b/apps/catalogue/templatetags/catalogue_tags.py index 25376f8c3..94753483c 100644 --- a/apps/catalogue/templatetags/catalogue_tags.py +++ b/apps/catalogue/templatetags/catalogue_tags.py @@ -61,9 +61,16 @@ def simple_title(tags): return capfirst(', '.join(title)) +def book_stub_title(book): + return ', '.join((book.author, book.title)) + + @register.simple_tag def book_title(book, html_links=False): - names = list(book.tags.filter(category='author')) + try: + names = list(book.tags.filter(category='author')) + except AttributeError: + return book_stub_title(book) books = [] while book: diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index cd74ac0f4..732221018 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -320,7 +320,7 @@ def _get_result_type(match): type = 'book' else: type = match.category - return dict(models.TAG_CATEGORIES)[type] + return type diff --git a/wolnelektury/static/css/master.css b/wolnelektury/static/css/master.css index 645466cb8..744082718 100644 --- a/wolnelektury/static/css/master.css +++ b/wolnelektury/static/css/master.css @@ -203,6 +203,14 @@ p .ac_input { } +/* ================== */ +/* = Search matches = */ +/* ================== */ + +.matches li:first-letter { + text-transform: uppercase; +} + /* ============= */ /* = Tags list = */ /* ============= */ diff --git a/wolnelektury/templates/catalogue/search_multiple_hits.html b/wolnelektury/templates/catalogue/search_multiple_hits.html index 8e99cdc97..b569e7dce 100644 --- a/wolnelektury/templates/catalogue/search_multiple_hits.html +++ b/wolnelektury/templates/catalogue/search_multiple_hits.html @@ -12,11 +12,17 @@

{% trans "More than one result matching the criteria found." %}

-
-- 2.20.1