view gpp/templates/search/search.html @ 412:639cfdf59167

Created import scripts for downloads and download comments.
author Brian Neal <bgneal@gmail.com>
date Thu, 07 Apr 2011 00:59:10 +0000
parents 0c18dfb1da1c
children b1f939b1fb01
line wrap: on
line source
{% extends 'base.html' %}
{% load highlight %}
{% block title %}Search{% endblock %}
{% block custom_js %}
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
      chkboxes = $('#search-form input[type="checkbox"]');
      $('#chk_all').click(function() {
         chkboxes.each(function(index) {
            $(this).attr('checked', true);
         });
         return false;
      });
      $('#chk_none').click(function() {
         chkboxes.each(function(index) {
            $(this).attr('checked', false);
         });
         return false;
      });
});
//]]>
</script>
{% endblock %}
{% block content %}
<h2>Search <img src="{{ STATIC_URL }}icons/magnifier.png" alt="Search" /></h2>
<form id="search-form" method="get" action=".">
<table>
   <tr>
      <td><input type="text" name="q" id="id_q" size="48" class="text" /></td>
      <td><input type="submit" value="Search" /></td>
   </tr>
</table>
<fieldset>
<legend>Search in:</legend>
<table>
   <tr>
      <td><input id="chk-forums" type="checkbox" name="models" value="forums.post" checked="checked" />
         <label for="chk-forums" class="pointer">Forum Posts</label></td>
      <td><input id="chk-news" type="checkbox" name="models" value="news.story" checked="checked" />
         <label for="chk-news" class="pointer">News Stories</label></td>
      <td><input id="chk-profiles" type="checkbox" name="models" value="bio.userprofile" checked="checked" />
         <label for="chk-profiles" class="pointer">User Profiles</label></td>
   </tr>
   <tr>
      <td><input id="chk-links" type="checkbox" name="models" value="weblinks.link" checked="checked" />
         <label for="chk-links" class="pointer">Links</label></td>
      <td><input id="chk-dls" type="checkbox" name="models" value="downloads.download" checked="checked" />
         <label for="chk-dls" class="pointer">Downloads</label></td>
      <td><input id="chk-podcasts" type="checkbox" name="models" value="podcast.item" checked="checked" />
         <label for="chk-podcasts" class="pointer">Podcasts</label></td>
   </tr>
   <tr>
      <td colspan="2"><input id="chk-ygroup" type="checkbox" name="models" value="ygroup.post" checked="checked" />
         <label for="chk-ygroup" class="pointer">Yahoo Group Archives</label></td>
   </tr>
</table>
<p><a href="#" id="chk_all">Check all</a> | <a href="#" id="chk_none">Check none</a></p>
</fieldset>
</form>

  {% if query %}
  <h3>Results for &quot;{{ query }}&quot; page {{ page.number }} of {{ page.paginator.num_pages }}</h3>

     {% if page.paginator.count %}
     <p>
     <strong>{{ page.paginator.count }} hit{{ page.paginator.count|pluralize }}</strong>
     </p>
     {% endif %}

      {% if page.object_list %}
      <dl>
      {% for result in page.object_list %}
         <dt>
         {{ result.verbose_name }}: <a href="{{ result.object.get_absolute_url }}">{{ result.object.search_title }}</a> ({{ result.score }})
         </dt>
         <dd>
            {% highlight result.object.search_summary with query css_class "highlight" max_length 200 %}
         </dd>
      {% endfor %}
      </dl>
      {% else %}
      <p>No results found for <em>{{ query }}</em>.</p>
      {% endif %}

      {% if page.has_previous or page.has_next %}
          <div>
              {% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
              |
              {% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
          </div>
      {% endif %}
  {% else %}
      {# Show some example queries to run, maybe query syntax, something else? #}
  {% endif %}
{% endblock %}