comparison gpp/templates/search/search.html @ 415:d4d167876c25

Fixing #205; search result pagination wasn't including models. Created a custom model search form so that the query term and model selections would persist across pages.
author Brian Neal <bgneal@gmail.com>
date Sun, 10 Apr 2011 00:32:14 +0000
parents b1f939b1fb01
children aabee29cadac
comparison
equal deleted inserted replaced
414:b1f939b1fb01 415:d4d167876c25
3 {% block title %}Search{% endblock %} 3 {% block title %}Search{% endblock %}
4 {% block custom_js %} 4 {% block custom_js %}
5 <script type="text/javascript"> 5 <script type="text/javascript">
6 //<![CDATA[ 6 //<![CDATA[
7 $(document).ready(function() { 7 $(document).ready(function() {
8 chkboxes = $('#search-form input[type="checkbox"]'); 8 var chkboxes = $('#search-form input[type="checkbox"]');
9 $('#chk_all').click(function() { 9 $('#chk_all').click(function() {
10 chkboxes.each(function(index) { 10 chkboxes.each(function(index) {
11 $(this).attr('checked', true); 11 $(this).attr('checked', true);
12 }); 12 });
13 return false; 13 return false;
16 chkboxes.each(function(index) { 16 chkboxes.each(function(index) {
17 $(this).attr('checked', false); 17 $(this).attr('checked', false);
18 }); 18 });
19 return false; 19 return false;
20 }); 20 });
21 $('#search-form ul').addClass('no-bullet-inline-block');
21 }); 22 });
22 //]]> 23 //]]>
23 </script> 24 </script>
24 {% endblock %} 25 {% endblock %}
25 {% block content %} 26 {% block content %}
26 <h2>Search <img src="{{ STATIC_URL }}icons/magnifier.png" alt="Search" /></h2> 27 <h2>Search <img src="{{ STATIC_URL }}icons/magnifier.png" alt="Search" /></h2>
27 <form id="search-form" method="get" action="."> 28 <form id="search-form" method="get" action=".">
28 <table> 29 {{ form.q }} <input type="submit" value="Search" />
29 <tr>
30 <td><input type="text" name="q" id="id_q" size="48" class="text" /></td>
31 <td><input type="submit" value="Search" /></td>
32 </tr>
33 </table>
34 <fieldset> 30 <fieldset>
35 <legend>Search in:</legend> 31 <legend>Search in:</legend>
36 <table> 32 {{ form.models }}
37 <tr>
38 <td><input id="chk-forums-topics" type="checkbox" name="models" value="forums.topic" checked="checked" />
39 <label for="chk-forums-topics" class="pointer">Forum Topics</label></td>
40
41 <td><input id="chk-forums-post" type="checkbox" name="models" value="forums.post" checked="checked" />
42 <label for="chk-forums-post" class="pointer">Forum Posts</label></td>
43 <td><input id="chk-news" type="checkbox" name="models" value="news.story" checked="checked" />
44 <label for="chk-news" class="pointer">News Stories</label></td>
45 </tr>
46 <tr>
47 <td><input id="chk-profiles" type="checkbox" name="models" value="bio.userprofile" checked="checked" />
48 <label for="chk-profiles" class="pointer">User Profiles</label></td>
49 <td><input id="chk-links" type="checkbox" name="models" value="weblinks.link" checked="checked" />
50 <label for="chk-links" class="pointer">Links</label></td>
51 <td><input id="chk-dls" type="checkbox" name="models" value="downloads.download" checked="checked" />
52 <label for="chk-dls" class="pointer">Downloads</label></td>
53 </tr>
54 <tr>
55 <td><input id="chk-podcasts" type="checkbox" name="models" value="podcast.item" checked="checked" />
56 <label for="chk-podcasts" class="pointer">Podcasts</label></td>
57 <td colspan="2"><input id="chk-ygroup" type="checkbox" name="models" value="ygroup.post" checked="checked" />
58 <label for="chk-ygroup" class="pointer">Yahoo Group Archives</label></td>
59 </tr>
60 </table>
61 <p><a href="#" id="chk_all">Check all</a> | <a href="#" id="chk_none">Check none</a></p> 33 <p><a href="#" id="chk_all">Check all</a> | <a href="#" id="chk_none">Check none</a></p>
62 </fieldset> 34 </fieldset>
63 </form> 35 </form>
64 36
65 {% if query %} 37 {% if query %}
86 <p>No results found for <em>{{ query }}</em>.</p> 58 <p>No results found for <em>{{ query }}</em>.</p>
87 {% endif %} 59 {% endif %}
88 60
89 {% if page.has_previous or page.has_next %} 61 {% if page.has_previous or page.has_next %}
90 <div> 62 <div>
91 {% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %} 63 {% if page.has_previous %}<a href="?{{ search_params }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
92 | 64 |
93 {% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %} 65 {% if page.has_next %}<a href="?{{ search_params }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
94 </div> 66 </div>
95 {% endif %} 67 {% endif %}
96 {% else %} 68 {% else %}
97 {# Show some example queries to run, maybe query syntax, something else? #} 69 {# Show some example queries to run, maybe query syntax, something else? #}
98 {% endif %} 70 {% endif %}