Merge branch 'production' into pretty
[wolnelektury.git] / wolnelektury / templates / catalogue / search_multiple_hits.html
1 {% extends "base.html" %}
2 {% load i18n %}
3 {% load catalogue_tags pagination_tags %}
4
5 {% block titleextra %}{% trans "Search" %}{% endblock %}
6
7 {% block bodyid %}tagged-object-list{% endblock %}
8
9 {% block body %}
10     <h1>{% trans "Search" %}</h1>
11
12     {% if did_you_mean %}
13       <span class="did_you_mean">{% trans "Dod you mean" %} <a href="{% url search %}?q={{did_you_mean|urlencode}}">{{did_you_mean|lower}}</a></b>?</span>
14     {% endif %}
15     <div id="results">
16       <ol>
17       {% for result in results %}
18       <li>
19         <p><a href="{{result.book.get_absolute_url}}">{{result.book.pretty_title}}</a> (id: {{result.book_id}}, score: {{result.score}})</p>
20         <ul>
21           {% for hit in result.hits %}
22           <li>
23             {% if hit.fragment %}
24             <a href="{{hit.fragment.get_absolute_url}}">Idź do fragmentu</a>
25             <div style="">Tagi/Motywy: {% for tag in hit.themes %}{{tag.name}} {% endfor %}</div>
26             {# snippets or short html? #}
27             {% if hit.snippets %}
28              {% for snip in hit.snippets %}
29                {{snip|safe}}<br/>
30              {% endfor %}
31             {% else %}
32              {{hit.fragment.short_text|safe}}
33             {% endif %}
34             
35             {% else %}
36             {# it's a section #}
37             <a href="{% url book_text result.book.slug %}#f{{hit.section_number}}">{{hit.header_index}}</a>
38              {% if hit.snippets %}
39               {% for snip in hit.snippets %}
40                 {{snip|safe}}<br/>
41               {% endfor %}
42              {% else %}
43                [section matched but no snippets :-(]
44              {% endif %}
45             {% endif %}
46           </li>
47           {% endfor %}
48
49         </ul>
50       </li>
51       {% empty %}
52       <p>No results.</p>
53       {% endfor %}
54       </ol>
55     </div>
56
57
58 {% comment %}
59     <div id="books-list">
60         <p>{% trans "More than one result matching the criteria found." %}</p>
61         <ul class='matches'>
62         {% for match, link, type in results %}
63           <li>{% trans type %}: <a href='{{ link }}'>
64             {% ifequal type "book" %}
65                 {% book_title match %}
66             {% else %}
67                 {{ match.name }}
68             {% endifequal %}
69           </a></li>
70         {% endfor %}
71         </ul>
72     </div>
73 {% endcomment %}
74
75 {% endblock %}