From: Radek Czajka Date: Tue, 6 Jul 2010 11:29:43 +0000 (+0200) Subject: Fixed #724: nicer search results X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/97d7b46edcc444cacafc2e4824618bfc322339c0?ds=inline Fixed #724: nicer search results --- 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." %}

-