Mercurial > public > sg101
annotate gpp/templates/search/search.html @ 276:8a46843c258f
Fixing tickets #119 & #124. All search categories are checked on the search form by default now. Made cosmetic tweaks as suggested in #124.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 30 Sep 2010 00:06:04 +0000 |
parents | a5fcf3d1b663 |
children | d424b8bae71d |
rev | line source |
---|---|
bgneal@219 | 1 {% extends 'base.html' %} |
bgneal@219 | 2 {% load highlight %} |
bgneal@219 | 3 {% block title %}Search{% endblock %} |
bgneal@219 | 4 {% block content %} |
bgneal@219 | 5 <h2>Search <img src="{{ MEDIA_URL }}icons/magnifier.png" alt="Search" /></h2> |
bgneal@219 | 6 <form method="get" action="."> |
bgneal@276 | 7 <table> |
bgneal@276 | 8 <tr> |
bgneal@276 | 9 <td><input type="text" name="q" id="id_q" /></td> |
bgneal@276 | 10 <td><input type="submit" value="Search" /></td> |
bgneal@276 | 11 </tr> |
bgneal@276 | 12 </table> |
bgneal@276 | 13 <fieldset> |
bgneal@276 | 14 <legend>Search in:</legend> |
bgneal@276 | 15 <table> |
bgneal@276 | 16 <tr> |
bgneal@276 | 17 <td><input type="checkbox" name="models" value="forums.post" checked="checked" />Forum Posts</td> |
bgneal@276 | 18 <td><input type="checkbox" name="models" value="news.story" checked="checked" />News Stories</td> |
bgneal@276 | 19 <td><input type="checkbox" name="models" value="bio.userprofile" checked="checked" />User Profiles</td> |
bgneal@276 | 20 </tr> |
bgneal@276 | 21 <tr> |
bgneal@276 | 22 <td><input type="checkbox" name="models" value="weblinks.link" checked="checked" />Links</td> |
bgneal@276 | 23 <td><input type="checkbox" name="models" value="downloads.download" checked="checked" />Downloads</td> |
bgneal@276 | 24 <td><input type="checkbox" name="models" value="podcast.item" checked="checked" />Podcasts</td> |
bgneal@276 | 25 </tr> |
bgneal@276 | 26 </table> |
bgneal@276 | 27 </fieldset> |
bgneal@276 | 28 |
bgneal@219 | 29 {% if query %} |
bgneal@219 | 30 <h3>Results</h3> |
bgneal@219 | 31 {% if page.object_list %} |
bgneal@219 | 32 <dl> |
bgneal@219 | 33 {% for result in page.object_list %} |
bgneal@219 | 34 <dt> |
bgneal@222 | 35 {{ result.verbose_name }}: <a href="{{ result.object.get_absolute_url }}">{{ result.object.search_title }}</a> ({{ result.score }}) |
bgneal@219 | 36 </dt> |
bgneal@219 | 37 <dd> |
bgneal@220 | 38 {% highlight result.object.search_summary with query css_class "highlight" max_length 200 %} |
bgneal@219 | 39 </dd> |
bgneal@219 | 40 {% endfor %} |
bgneal@219 | 41 </dl> |
bgneal@220 | 42 {% else %} |
bgneal@220 | 43 <p>No results found for <em>{{ query }}</em>.</p> |
bgneal@219 | 44 {% endif %} |
bgneal@219 | 45 |
bgneal@219 | 46 {% if page.has_previous or page.has_next %} |
bgneal@219 | 47 <div> |
bgneal@219 | 48 {% if page.has_previous %}<a href="?q={{ query }}&page={{ page.previous_page_number }}">{% endif %}« Previous{% if page.has_previous %}</a>{% endif %} |
bgneal@219 | 49 | |
bgneal@219 | 50 {% if page.has_next %}<a href="?q={{ query }}&page={{ page.next_page_number }}">{% endif %}Next »{% if page.has_next %}</a>{% endif %} |
bgneal@219 | 51 </div> |
bgneal@219 | 52 {% endif %} |
bgneal@219 | 53 {% else %} |
bgneal@219 | 54 {# Show some example queries to run, maybe query syntax, something else? #} |
bgneal@219 | 55 {% endif %} |
bgneal@219 | 56 </form> |
bgneal@219 | 57 {% endblock %} |