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