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@323
|
8 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@323
|
21 });
|
bgneal@323
|
22 //]]>
|
bgneal@323
|
23 </script>
|
bgneal@323
|
24 {% endblock %}
|
bgneal@219
|
25 {% block content %}
|
bgneal@312
|
26 <h2>Search <img src="{{ STATIC_URL }}icons/magnifier.png" alt="Search" /></h2>
|
bgneal@323
|
27 <form id="search-form" method="get" action=".">
|
bgneal@276
|
28 <table>
|
bgneal@276
|
29 <tr>
|
bgneal@279
|
30 <td><input type="text" name="q" id="id_q" size="48" class="text" /></td>
|
bgneal@276
|
31 <td><input type="submit" value="Search" /></td>
|
bgneal@276
|
32 </tr>
|
bgneal@276
|
33 </table>
|
bgneal@276
|
34 <fieldset>
|
bgneal@276
|
35 <legend>Search in:</legend>
|
bgneal@276
|
36 <table>
|
bgneal@276
|
37 <tr>
|
bgneal@414
|
38 <td><input id="chk-forums-topics" type="checkbox" name="models" value="forums.topic" checked="checked" />
|
bgneal@414
|
39 <label for="chk-forums-topics" class="pointer">Forum Topics</label></td>
|
bgneal@414
|
40
|
bgneal@414
|
41 <td><input id="chk-forums-post" type="checkbox" name="models" value="forums.post" checked="checked" />
|
bgneal@414
|
42 <label for="chk-forums-post" class="pointer">Forum Posts</label></td>
|
bgneal@323
|
43 <td><input id="chk-news" type="checkbox" name="models" value="news.story" checked="checked" />
|
bgneal@323
|
44 <label for="chk-news" class="pointer">News Stories</label></td>
|
bgneal@414
|
45 </tr>
|
bgneal@414
|
46 <tr>
|
bgneal@323
|
47 <td><input id="chk-profiles" type="checkbox" name="models" value="bio.userprofile" checked="checked" />
|
bgneal@323
|
48 <label for="chk-profiles" class="pointer">User Profiles</label></td>
|
bgneal@323
|
49 <td><input id="chk-links" type="checkbox" name="models" value="weblinks.link" checked="checked" />
|
bgneal@323
|
50 <label for="chk-links" class="pointer">Links</label></td>
|
bgneal@323
|
51 <td><input id="chk-dls" type="checkbox" name="models" value="downloads.download" checked="checked" />
|
bgneal@323
|
52 <label for="chk-dls" class="pointer">Downloads</label></td>
|
bgneal@414
|
53 </tr>
|
bgneal@414
|
54 <tr>
|
bgneal@323
|
55 <td><input id="chk-podcasts" type="checkbox" name="models" value="podcast.item" checked="checked" />
|
bgneal@323
|
56 <label for="chk-podcasts" class="pointer">Podcasts</label></td>
|
bgneal@323
|
57 <td colspan="2"><input id="chk-ygroup" type="checkbox" name="models" value="ygroup.post" checked="checked" />
|
bgneal@323
|
58 <label for="chk-ygroup" class="pointer">Yahoo Group Archives</label></td>
|
bgneal@276
|
59 </tr>
|
bgneal@276
|
60 </table>
|
bgneal@323
|
61 <p><a href="#" id="chk_all">Check all</a> | <a href="#" id="chk_none">Check none</a></p>
|
bgneal@276
|
62 </fieldset>
|
bgneal@323
|
63 </form>
|
bgneal@276
|
64
|
bgneal@219
|
65 {% if query %}
|
bgneal@277
|
66 <h3>Results for "{{ query }}" page {{ page.number }} of {{ page.paginator.num_pages }}</h3>
|
bgneal@277
|
67
|
bgneal@277
|
68 {% if page.paginator.count %}
|
bgneal@277
|
69 <p>
|
bgneal@277
|
70 <strong>{{ page.paginator.count }} hit{{ page.paginator.count|pluralize }}</strong>
|
bgneal@277
|
71 </p>
|
bgneal@277
|
72 {% endif %}
|
bgneal@277
|
73
|
bgneal@219
|
74 {% if page.object_list %}
|
bgneal@219
|
75 <dl>
|
bgneal@219
|
76 {% for result in page.object_list %}
|
bgneal@219
|
77 <dt>
|
bgneal@222
|
78 {{ result.verbose_name }}: <a href="{{ result.object.get_absolute_url }}">{{ result.object.search_title }}</a> ({{ result.score }})
|
bgneal@219
|
79 </dt>
|
bgneal@219
|
80 <dd>
|
bgneal@220
|
81 {% highlight result.object.search_summary with query css_class "highlight" max_length 200 %}
|
bgneal@219
|
82 </dd>
|
bgneal@219
|
83 {% endfor %}
|
bgneal@219
|
84 </dl>
|
bgneal@220
|
85 {% else %}
|
bgneal@220
|
86 <p>No results found for <em>{{ query }}</em>.</p>
|
bgneal@219
|
87 {% endif %}
|
bgneal@219
|
88
|
bgneal@219
|
89 {% if page.has_previous or page.has_next %}
|
bgneal@219
|
90 <div>
|
bgneal@219
|
91 {% if page.has_previous %}<a href="?q={{ query }}&page={{ page.previous_page_number }}">{% endif %}« Previous{% if page.has_previous %}</a>{% endif %}
|
bgneal@219
|
92 |
|
bgneal@219
|
93 {% if page.has_next %}<a href="?q={{ query }}&page={{ page.next_page_number }}">{% endif %}Next »{% if page.has_next %}</a>{% endif %}
|
bgneal@219
|
94 </div>
|
bgneal@219
|
95 {% endif %}
|
bgneal@219
|
96 {% else %}
|
bgneal@219
|
97 {# Show some example queries to run, maybe query syntax, something else? #}
|
bgneal@219
|
98 {% endif %}
|
bgneal@219
|
99 {% endblock %}
|