search.html 2.62 KB
Newer Older
fred's avatar
fred committed
1 2
{% extends 'panikdb/base.html' %}
{% load paniktags %}
3
{% load highlight %}
Simon Daron's avatar
Simon Daron committed
4
{% block bodyID %}Search{% endblock %}
Simon Daron's avatar
Simon Daron committed
5 6
{% block title %}Recherche{% endblock %}
{% block nav %}	
7
<div class="search">
fred's avatar
fred committed
8
    <form method="get" action="." class="big center" id="search-form">
Simon Daron's avatar
Simon Daron committed
9 10
            {{ form.as_table }}<button class="icon-search"></button>
    </form>
fred's avatar
fred committed
11
	{% if query or selected_tags %}
12
		<nav>
Simon Daron's avatar
Simon Daron committed
13
		    {% if facets.fields.categories %}
14
		    <ul class="custom padded">
Simon Daron's avatar
Simon Daron committed
15
		      {# Provide only the top 5 categories #}
16 17 18 19 20 21 22 23 24 25 26
				{% for category in facets.fields.categories|slice:":5" %}
				<li>
					  {% if category.0 in selected_categories %}
					  	<a class="check icon-check count-{{ category.1 }}" href="{{ request.get_full_path|remove_category_facet:category.0 }}">
							{{ category.0 }} | {{ category.1 }}
						</a>
					  {% else %}
						<a class="check icon-check-empty count-{{ category.1 }}" href="{{ request.get_full_path|append_category_facet:category.0 }}">{{ category.0 }} | {{ category.1 }}</a></span>
					  {% endif %}
				</li>
				{% endfor %}
Simon Daron's avatar
Simon Daron committed
27 28 29
		    </ul>
		    {% endif %}
		</nav>
30
		<nav>
Simon Daron's avatar
Simon Daron committed
31
		    {% if facets.fields.tags %}
32
		    <ul class="tag-facets custom padded">
Simon Daron's avatar
Simon Daron committed
33 34 35 36
		      {# Provide only the top 5 tags #}
			{% for tag in facets.fields.tags|slice:":20" %}
			<li>
			  {% if tag.0 in selected_tags %}
Simon Daron's avatar
Simon Daron committed
37
				<a class="check icon-check count-{{ tag.1 }}" href="{{ request.get_full_path|remove_tag_facet:tag.0 }}">
Simon Daron's avatar
Simon Daron committed
38 39 40
					{{ tag.0 }} | {{ tag.1 }}
				</a> 
			  {% else %}
Simon Daron's avatar
Simon Daron committed
41
			    	<a class="check icon-check-empty count-{{ tag.1 }}" href="{{ request.get_full_path|append_tag_facet:tag.0 }}">{{ tag.0 }} | {{ tag.1 }}</a> 
Simon Daron's avatar
Simon Daron committed
42 43 44 45 46
			  {% endif %}
			</li>
			{% endfor %}
		    </ul>
		    {% endif %}
fred's avatar
fred committed
47

Simon Daron's avatar
Simon Daron committed
48 49 50
		</nav>
	{% endif %}
</div>
fred's avatar
fred committed
51 52 53 54
{% endblock %}


{% block main %}
fred's avatar
fred committed
55
	{% if query or selected_tags %}
Simon Daron's avatar
Simon Daron committed
56
<div class="wrapper">
57
	<div class="marged">
Simon Daron's avatar
Simon Daron committed
58
		{% if not page.object_list %}
59
			<div class="big error center">Sorry, no result with your query!</div>
Simon Daron's avatar
Simon Daron committed
60
		{% endif %}
Simon Daron's avatar
Simon Daron committed
61 62 63 64 65
		{% if page.has_previous %}
			<div class="previous-page cf">
				<a class="button big left" href="?q={{ query }}&amp;page={{ page.previous_page_number }}">&laquo; Résultats précédénts</a>
			</div>
		{% endif %}
fred's avatar
fred committed
66

67
		<ul id="search-results" class="custom list columns cf padded">
fred's avatar
fred committed
68 69


Simon Daron's avatar
Simon Daron committed
70
		{% for result in page.object_list %}
71
				{% if result.object.title %}
Simon Daron's avatar
Simon Daron committed
72
			<li class="ellipsis">
73
					{% search_result_template result %}
Simon Daron's avatar
Simon Daron committed
74
			</li>
75
				{% endif %}
Simon Daron's avatar
Simon Daron committed
76
		{% endfor %}
fred's avatar
fred committed
77 78


Simon Daron's avatar
Simon Daron committed
79 80 81 82 83 84
		</ul>
		{% if page.has_next %}
			<div class="next-page cf">
				<a class="button big right" href="?q={{ query }}&amp;page={{ page.next_page_number }}">Résultats suivants &raquo;</a>
			</div>
		{% endif %}
Simon Daron's avatar
Simon Daron committed
85
	</div>
Simon Daron's avatar
Simon Daron committed
86
</div>
87
	{% endif %}
fred's avatar
fred committed
88
{% endblock %}