Mercurial > public > sg101
annotate gpp/templates/search/search.html @ 219:26ee684c2033
Initial commit of Haystack search integration. See #51.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 05 Jun 2010 20:46:52 +0000 |
parents | |
children | 71fd8454688b |
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@219 | 22 {{ result.verbose_name }}: {{ result.title|safe }} • {{ result.score }} |
bgneal@219 | 23 </dt> |
bgneal@219 | 24 <dd> |
bgneal@219 | 25 {% highlight result.summary with query css_class "highlight" max_length 200 %} |
bgneal@219 | 26 </dd> |
bgneal@219 | 27 {% endfor %} |
bgneal@219 | 28 </dl> |
bgneal@219 | 29 {% endif %} |
bgneal@219 | 30 |
bgneal@219 | 31 {% if page.has_previous or page.has_next %} |
bgneal@219 | 32 <div> |
bgneal@219 | 33 {% if page.has_previous %}<a href="?q={{ query }}&page={{ page.previous_page_number }}">{% endif %}« Previous{% if page.has_previous %}</a>{% endif %} |
bgneal@219 | 34 | |
bgneal@219 | 35 {% if page.has_next %}<a href="?q={{ query }}&page={{ page.next_page_number }}">{% endif %}Next »{% if page.has_next %}</a>{% endif %} |
bgneal@219 | 36 </div> |
bgneal@219 | 37 {% endif %} |
bgneal@219 | 38 {% else %} |
bgneal@219 | 39 {# Show some example queries to run, maybe query syntax, something else? #} |
bgneal@219 | 40 {% endif %} |
bgneal@219 | 41 </form> |
bgneal@219 | 42 {% endblock %} |