bgneal@219: {% extends 'base.html' %}
bgneal@219: {% load highlight %}
bgneal@219: {% block title %}Search{% endblock %}
bgneal@323: {% block custom_js %}
bgneal@323: <script type="text/javascript">
bgneal@323: //<![CDATA[
bgneal@323: $(document).ready(function() {
bgneal@415:       var chkboxes = $('#search-form input[type="checkbox"]');
bgneal@323:       $('#chk_all').click(function() {
bgneal@323:          chkboxes.each(function(index) {
bgneal@323:             $(this).attr('checked', true);
bgneal@323:          });
bgneal@323:          return false;
bgneal@323:       });
bgneal@323:       $('#chk_none').click(function() {
bgneal@323:          chkboxes.each(function(index) {
bgneal@323:             $(this).attr('checked', false);
bgneal@323:          });
bgneal@323:          return false;
bgneal@323:       });
bgneal@415:       $('#search-form ul').addClass('no-bullet-inline-block');
bgneal@416:       $('#search-form ul li input').css('vertical-align', 'middle');
bgneal@323: });
bgneal@323: //]]>
bgneal@323: </script>
bgneal@323: {% endblock %}
bgneal@219: {% block content %}
bgneal@312: <h2>Search <img src="{{ STATIC_URL }}icons/magnifier.png" alt="Search" /></h2>
bgneal@323: <form id="search-form" method="get" action=".">
bgneal@415: {{ form.q }} <input type="submit" value="Search" />
bgneal@276: <fieldset>
bgneal@276: <legend>Search in:</legend>
bgneal@415: {{ form.models }}
bgneal@323: <p><a href="#" id="chk_all">Check all</a> | <a href="#" id="chk_none">Check none</a></p>
bgneal@276: </fieldset>
bgneal@323: </form>
bgneal@276: 
bgneal@219:   {% if query %}
bgneal@277:   <h3>Results for &quot;{{ query }}&quot; page {{ page.number }} of {{ page.paginator.num_pages }}</h3>
bgneal@277: 
bgneal@277:      {% if page.paginator.count %}
bgneal@277:      <p>
bgneal@277:      <strong>{{ page.paginator.count }} hit{{ page.paginator.count|pluralize }}</strong>
bgneal@277:      </p>
bgneal@277:      {% endif %}
bgneal@277: 
bgneal@219:       {% if page.object_list %}
bgneal@219:       <dl>
bgneal@219:       {% for result in page.object_list %}
bgneal@219:          <dt>
bgneal@222:          {{ result.verbose_name }}: <a href="{{ result.object.get_absolute_url }}">{{ result.object.search_title }}</a> ({{ result.score }})
bgneal@219:          </dt>
bgneal@219:          <dd>
bgneal@220:             {% highlight result.object.search_summary with query css_class "highlight" max_length 200 %}
bgneal@219:          </dd>
bgneal@219:       {% endfor %}
bgneal@219:       </dl>
bgneal@220:       {% else %}
bgneal@220:       <p>No results found for <em>{{ query }}</em>.</p>
bgneal@219:       {% endif %}
bgneal@219: 
bgneal@219:       {% if page.has_previous or page.has_next %}
bgneal@219:           <div>
bgneal@415:               {% if page.has_previous %}<a href="?{{ search_params }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
bgneal@219:               |
bgneal@415:               {% if page.has_next %}<a href="?{{ search_params }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
bgneal@219:           </div>
bgneal@219:       {% endif %}
bgneal@219:   {% else %}
bgneal@219:       {# Show some example queries to run, maybe query syntax, something else? #}
bgneal@219:   {% endif %}
bgneal@219: {% endblock %}