{% extends template_name %}


{% block content %}

{% extrahead %}
<style type="text/css">
#search_result ul li {
    cursor:pointer;	
}
#search_result h3 {
    padding: 0px;
    margin: 0em 0em 0.5em 1em;
    line-height: 1em;
}
#search_result_list {
    background-color: #fff;
    list-style-type: none;
    padding: 1em;
    margin: 1em;
}
#search_result_list > li {
    padding: 1em;
    margin: 1em;
}
#search_result_list > li:nth-child(2n) {
    background-color: #eee;
}
#search_result_list > li {
    color: #aaa;
}
#search_result_list > li strong {
    color: #555;
}
#search_result_list > li:hover {
    color: #000;
}
#search_result_list > li:hover strong {
    color: #00f;
}
</style>
{% endextrahead %}


<form id="search_form" method="post" action="{{ form_url }}" class="pylucid_form">
	{% csrf_token %}
	<input type="hidden" name="search_page" value="true" >
    <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 %}
<div id="search_result">
	<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 %}
		<ul id="search_result_list">
	    {% for hit in search_results %}   
	         <li onclick="JavaScript:window.location.href='{{ hit.url }}';">
	                <a href="{{ hit.url }}" title="goto {{ hit.url }}">
	                	<h3 class="no_anchor">{{ hit.headline }}</h3>
	                </a>
	                <ul title="score: {{ hit.score }}, language: {{ hit.language.description }}, content type: {{ hit.content_type }}">
		                {% for pre_txt, hit_txt, post_txt in hit.cutouts %}
		                    <li>...{{ pre_txt }} <strong>{{ hit_txt }}</strong> {{ post_txt }}...</li>
		                {% endfor %}
	                </ul>
	        </li>
	    {% endfor %}
	    </ul>
	{% endif %}
</div>
{% endif %}
	
{% endblock content %}