{% extends g.theme.master %}

{% block title %}{{c.project.name}} / {{c.app.config.options.mount_label}} / Search{% endblock %}

{% block header %}Search {{c.app.config.options.mount_point}}: {{q}}{% endblock %}

{% block content %}
  <form method="GET" action=".">
    <input type="text" name="q" value="{{q}}" class="defaultText" title="Search App"/><br/>
    <input type="submit" value="Search App"/>
    <input type="submit" name="project" value="Search Entire Project"/><br/>
    Search history? <input type="checkbox" name="history"{% if history %} checked="checked"{% endif %}/><br/>
  </form>
  {% if q %}
    {% if count == 0 %}
      <p>No results.</p>
    {% elif count==1 %}
      <p>{{count}} result.</p>
    {% elif count > 1 %}
      <p>{{count}} results.</p>
    {% endif %}
  {% endif %}
  {% for doc in results %}
    <div>
      <a href="{{doc['url_s']}}">{{doc.title_s}}</a><br/>
      {% if doc.get('snippet') %}<p>{{doc.snippet}}</p>{% endif %}
      <hr/>
    </div>
  {% endfor %}
{% endblock %}