Mercurial > public > sg101
annotate gpp/templates/search/search.html @ 233:6dde069debd4
Fix bug in r246.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 01 Aug 2010 21:30:22 +0000 |
parents | a5fcf3d1b663 |
children | 8a46843c258f |
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@219 | 7 <table> |
bgneal@219 | 8 {{ form.as_table }} |
bgneal@219 | 9 <tr> |
bgneal@219 | 10 <td> </td> |
bgneal@219 | 11 <td> |
bgneal@219 | 12 <input type="submit" value="Search"> |
bgneal@219 | 13 </td> |
bgneal@219 | 14 </tr> |
bgneal@219 | 15 </table> |
bgneal@219 | 16 {% if query %} |
bgneal@219 | 17 <h3>Results</h3> |
bgneal@219 | 18 {% if page.object_list %} |
bgneal@219 | 19 <dl> |
bgneal@219 | 20 {% for result in page.object_list %} |
bgneal@219 | 21 <dt> |
bgneal@222 | 22 {{ result.verbose_name }}: <a href="{{ result.object.get_absolute_url }}">{{ result.object.search_title }}</a> ({{ result.score }}) |
bgneal@219 | 23 </dt> |
bgneal@219 | 24 <dd> |
bgneal@220 | 25 {% highlight result.object.search_summary with query css_class "highlight" max_length 200 %} |
bgneal@219 | 26 </dd> |
bgneal@219 | 27 {% endfor %} |
bgneal@219 | 28 </dl> |
bgneal@220 | 29 {% else %} |
bgneal@220 | 30 <p>No results found for <em>{{ query }}</em>.</p> |
bgneal@219 | 31 {% endif %} |
bgneal@219 | 32 |
bgneal@219 | 33 {% if page.has_previous or page.has_next %} |
bgneal@219 | 34 <div> |
bgneal@219 | 35 {% if page.has_previous %}<a href="?q={{ query }}&page={{ page.previous_page_number }}">{% endif %}« Previous{% if page.has_previous %}</a>{% endif %} |
bgneal@219 | 36 | |
bgneal@219 | 37 {% if page.has_next %}<a href="?q={{ query }}&page={{ page.next_page_number }}">{% endif %}Next »{% if page.has_next %}</a>{% endif %} |
bgneal@219 | 38 </div> |
bgneal@219 | 39 {% endif %} |
bgneal@219 | 40 {% else %} |
bgneal@219 | 41 {# Show some example queries to run, maybe query syntax, something else? #} |
bgneal@219 | 42 {% endif %} |
bgneal@219 | 43 </form> |
bgneal@219 | 44 {% endblock %} |