Mercurial > public > sg101
annotate gpp/templates/search/search.html @ 220:71fd8454688b
For #51, added weblinks to search. Decided against using the search index to store prerendered results. My fear is this could get too unweildy once we add forums.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 06 Jun 2010 20:06:15 +0000 |
parents | 26ee684c2033 |
children | a5fcf3d1b663 |
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@220 | 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 %} |