bgneal@219
|
1 {% extends 'base.html' %}
|
bgneal@219
|
2 {% load highlight %}
|
bgneal@219
|
3 {% block title %}Search{% endblock %}
|
bgneal@323
|
4 {% block custom_js %}
|
bgneal@323
|
5 <script type="text/javascript">
|
bgneal@323
|
6 //<![CDATA[
|
bgneal@323
|
7 $(document).ready(function() {
|
bgneal@415
|
8 var chkboxes = $('#search-form input[type="checkbox"]');
|
bgneal@323
|
9 $('#chk_all').click(function() {
|
bgneal@323
|
10 chkboxes.each(function(index) {
|
bgneal@323
|
11 $(this).attr('checked', true);
|
bgneal@323
|
12 });
|
bgneal@323
|
13 return false;
|
bgneal@323
|
14 });
|
bgneal@323
|
15 $('#chk_none').click(function() {
|
bgneal@323
|
16 chkboxes.each(function(index) {
|
bgneal@323
|
17 $(this).attr('checked', false);
|
bgneal@323
|
18 });
|
bgneal@323
|
19 return false;
|
bgneal@323
|
20 });
|
bgneal@415
|
21 $('#search-form ul').addClass('no-bullet-inline-block');
|
bgneal@416
|
22 $('#search-form ul li input').css('vertical-align', 'middle');
|
bgneal@323
|
23 });
|
bgneal@323
|
24 //]]>
|
bgneal@323
|
25 </script>
|
bgneal@323
|
26 {% endblock %}
|
bgneal@219
|
27 {% block content %}
|
bgneal@312
|
28 <h2>Search <img src="{{ STATIC_URL }}icons/magnifier.png" alt="Search" /></h2>
|
bgneal@323
|
29 <form id="search-form" method="get" action=".">
|
bgneal@415
|
30 {{ form.q }} <input type="submit" value="Search" />
|
bgneal@276
|
31 <fieldset>
|
bgneal@276
|
32 <legend>Search in:</legend>
|
bgneal@415
|
33 {{ form.models }}
|
bgneal@323
|
34 <p><a href="#" id="chk_all">Check all</a> | <a href="#" id="chk_none">Check none</a></p>
|
bgneal@276
|
35 </fieldset>
|
bgneal@323
|
36 </form>
|
bgneal@276
|
37
|
bgneal@219
|
38 {% if query %}
|
bgneal@277
|
39 <h3>Results for "{{ query }}" page {{ page.number }} of {{ page.paginator.num_pages }}</h3>
|
bgneal@277
|
40
|
bgneal@277
|
41 {% if page.paginator.count %}
|
bgneal@277
|
42 <p>
|
bgneal@277
|
43 <strong>{{ page.paginator.count }} hit{{ page.paginator.count|pluralize }}</strong>
|
bgneal@277
|
44 </p>
|
bgneal@277
|
45 {% endif %}
|
bgneal@277
|
46
|
bgneal@219
|
47 {% if page.object_list %}
|
bgneal@219
|
48 <dl>
|
bgneal@219
|
49 {% for result in page.object_list %}
|
bgneal@219
|
50 <dt>
|
bgneal@222
|
51 {{ result.verbose_name }}: <a href="{{ result.object.get_absolute_url }}">{{ result.object.search_title }}</a> ({{ result.score }})
|
bgneal@219
|
52 </dt>
|
bgneal@219
|
53 <dd>
|
bgneal@220
|
54 {% highlight result.object.search_summary with query css_class "highlight" max_length 200 %}
|
bgneal@219
|
55 </dd>
|
bgneal@219
|
56 {% endfor %}
|
bgneal@219
|
57 </dl>
|
bgneal@220
|
58 {% else %}
|
bgneal@220
|
59 <p>No results found for <em>{{ query }}</em>.</p>
|
bgneal@219
|
60 {% endif %}
|
bgneal@219
|
61
|
bgneal@219
|
62 {% if page.has_previous or page.has_next %}
|
bgneal@219
|
63 <div>
|
bgneal@415
|
64 {% if page.has_previous %}<a href="?{{ search_params }}&page={{ page.previous_page_number }}">{% endif %}« Previous{% if page.has_previous %}</a>{% endif %}
|
bgneal@219
|
65 |
|
bgneal@415
|
66 {% if page.has_next %}<a href="?{{ search_params }}&page={{ page.next_page_number }}">{% endif %}Next »{% if page.has_next %}</a>{% endif %}
|
bgneal@219
|
67 </div>
|
bgneal@219
|
68 {% endif %}
|
bgneal@219
|
69 {% else %}
|
bgneal@219
|
70 {# Show some example queries to run, maybe query syntax, something else? #}
|
bgneal@219
|
71 {% endif %}
|
bgneal@219
|
72 {% endblock %}
|