fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3c69d2c
)
Fixed #724: nicer search results
author
Radek Czajka
<radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 6 Jul 2010 11:29:43 +0000
(13:29 +0200)
committer
Radek Czajka
<radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 6 Jul 2010 11:30:05 +0000
(13:30 +0200)
apps/catalogue/templatetags/catalogue_tags.py
patch
|
blob
|
history
apps/catalogue/views.py
patch
|
blob
|
history
wolnelektury/static/css/master.css
patch
|
blob
|
history
wolnelektury/templates/catalogue/search_multiple_hits.html
patch
|
blob
|
history
diff --git
a/apps/catalogue/templatetags/catalogue_tags.py
b/apps/catalogue/templatetags/catalogue_tags.py
index
25376f8
..
9475348
100644
(file)
--- 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))
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):
@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:
books = []
while book:
diff --git
a/apps/catalogue/views.py
b/apps/catalogue/views.py
index
cd74ac0
..
7322210
100644
(file)
--- 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
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
645466c
..
7440827
100644
(file)
--- 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 = */
/* ============= */
/* ============= */
/* = Tags list = */
/* ============= */
diff --git
a/wolnelektury/templates/catalogue/search_multiple_hits.html
b/wolnelektury/templates/catalogue/search_multiple_hits.html
index
8e99cdc
..
b569e7d
100644
(file)
--- a/
wolnelektury/templates/catalogue/search_multiple_hits.html
+++ b/
wolnelektury/templates/catalogue/search_multiple_hits.html
@@
-12,11
+12,17
@@
<div id="books-list">
<p>{% trans "More than one result matching the criteria found." %}</p>
<div id="books-list">
<p>{% trans "More than one result matching the criteria found." %}</p>
-
<ul class='matches'>
+ <ul class='matches'>
{% for match, link, type in results %}
{% for match, link, type in results %}
- <li><a href='{{ link }}'>{{ match.name }}</a> ({{ type }})</li>
+ <li>{% trans type %}: <a href='{{ link }}'>
+ {% ifequal type "book" %}
+ {% book_title match %}
+ {% else %}
+ {{ match.name }}
+ {% endifequal %}
+ </a></li>
{% endfor %}
{% endfor %}
-
</ul>
+ </ul>
</div>
<div id="set-window">
</div>
<div id="set-window">