annotate gpp/templates/search/search.html @ 331:1ea63aa3f21d

Committing DreadInBabylon's default avatar.
author Brian Neal <bgneal@gmail.com>
date Thu, 24 Feb 2011 04:01:18 +0000
parents 0c18dfb1da1c
children b1f939b1fb01
rev   line source
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@323 38 <td><input id="chk-forums" type="checkbox" name="models" value="forums.post" checked="checked" />
bgneal@323 39 <label for="chk-forums" class="pointer">Forum Posts</label></td>
bgneal@323 40 <td><input id="chk-news" type="checkbox" name="models" value="news.story" checked="checked" />
bgneal@323 41 <label for="chk-news" class="pointer">News Stories</label></td>
bgneal@323 42 <td><input id="chk-profiles" type="checkbox" name="models" value="bio.userprofile" checked="checked" />
bgneal@323 43 <label for="chk-profiles" class="pointer">User Profiles</label></td>
bgneal@276 44 </tr>
bgneal@276 45 <tr>
bgneal@323 46 <td><input id="chk-links" type="checkbox" name="models" value="weblinks.link" checked="checked" />
bgneal@323 47 <label for="chk-links" class="pointer">Links</label></td>
bgneal@323 48 <td><input id="chk-dls" type="checkbox" name="models" value="downloads.download" checked="checked" />
bgneal@323 49 <label for="chk-dls" class="pointer">Downloads</label></td>
bgneal@323 50 <td><input id="chk-podcasts" type="checkbox" name="models" value="podcast.item" checked="checked" />
bgneal@323 51 <label for="chk-podcasts" class="pointer">Podcasts</label></td>
bgneal@323 52 </tr>
bgneal@323 53 <tr>
bgneal@323 54 <td colspan="2"><input id="chk-ygroup" type="checkbox" name="models" value="ygroup.post" checked="checked" />
bgneal@323 55 <label for="chk-ygroup" class="pointer">Yahoo Group Archives</label></td>
bgneal@276 56 </tr>
bgneal@276 57 </table>
bgneal@323 58 <p><a href="#" id="chk_all">Check all</a> | <a href="#" id="chk_none">Check none</a></p>
bgneal@276 59 </fieldset>
bgneal@323 60 </form>
bgneal@276 61
bgneal@219 62 {% if query %}
bgneal@277 63 <h3>Results for &quot;{{ query }}&quot; page {{ page.number }} of {{ page.paginator.num_pages }}</h3>
bgneal@277 64
bgneal@277 65 {% if page.paginator.count %}
bgneal@277 66 <p>
bgneal@277 67 <strong>{{ page.paginator.count }} hit{{ page.paginator.count|pluralize }}</strong>
bgneal@277 68 </p>
bgneal@277 69 {% endif %}
bgneal@277 70
bgneal@219 71 {% if page.object_list %}
bgneal@219 72 <dl>
bgneal@219 73 {% for result in page.object_list %}
bgneal@219 74 <dt>
bgneal@222 75 {{ result.verbose_name }}: <a href="{{ result.object.get_absolute_url }}">{{ result.object.search_title }}</a> ({{ result.score }})
bgneal@219 76 </dt>
bgneal@219 77 <dd>
bgneal@220 78 {% highlight result.object.search_summary with query css_class "highlight" max_length 200 %}
bgneal@219 79 </dd>
bgneal@219 80 {% endfor %}
bgneal@219 81 </dl>
bgneal@220 82 {% else %}
bgneal@220 83 <p>No results found for <em>{{ query }}</em>.</p>
bgneal@219 84 {% endif %}
bgneal@219 85
bgneal@219 86 {% if page.has_previous or page.has_next %}
bgneal@219 87 <div>
bgneal@219 88 {% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
bgneal@219 89 |
bgneal@219 90 {% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
bgneal@219 91 </div>
bgneal@219 92 {% endif %}
bgneal@219 93 {% else %}
bgneal@219 94 {# Show some example queries to run, maybe query syntax, something else? #}
bgneal@219 95 {% endif %}
bgneal@219 96 {% endblock %}