{% extends template_name %}

{% block content %}
<form id="search_form" method="post" action="{{ form_url }}" class="pylucid_form">
    <fieldset>
    <h2 class="form_collapse">Search Form</h2>
        {% include "admin/pylucid/includes/pylucid_formset.html" %}
        <input type="submit" value="search" />
    </fieldset>
</form>

{% if search_results %}
    <h2>Search results:</h2>
    <p>
        Search in {{ search_results.plugin_count }} plugins,
        duration: {{ search_results.duration|floatformat:3 }}sec.,
        hits: {{ search_results.hits|length }}.
    </p>
    {% if search_results.hits|length_is:"0" %}
        <p>Nothing found!</p>
    {% else %}
        <table>
        	<tr>
        	    <th>score</th>
        	    <th title="language of the hit">language</th>
        	    <th>content_type</th>
        	    <th>hits</th>
        	</tr>
        {% for hit in search_results %}   
             <tr onclick="JavaScript:window.location.href='{{ hit.url }}';" title="{{ hit.url }}">
                <td title="score">{{ hit.score }}</td>
                <td title="hit language is: {{ hit.language.description }}">{{ hit.language.code }}</td>
                <td title="content_type">{{ hit.content_type }}</td>
                <td>
                    <a href="{{ hit.url }}">
                    {{ hit.headline }}
                    </a><br />
                    <ul class="cutouts">
                    {% for pre_txt, hit_txt, post_txt in hit.cutouts %}
                        <li>...{{ pre_txt }} <strong>{{ hit_txt }}</strong> {{ post_txt }}...</li>
                    {% endfor %}
                    </ul>
                </td>
            </tr>
        {% endfor %}
        </table>
    {% endif %}
{% endif %}
	
{% endblock content %}