search.html 2.96 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
8
9
10
11
12
13
14
15
16
<div class="mainSub">
    <div class="wrapper">
        <nav>
        <form method="get" action="." class="big marged" id="search-form">
                {{ form.as_table }}<button class="icon-search"></button>
        </form>
        </nav>
    </div>
</div>
<div class="wrapper">
fred's avatar
fred committed
17
    <div class="search-filters">
fred's avatar
fred committed
18
	{% if query or selected_tags %}
19
		<nav class="">
Simon Daron's avatar
Simon Daron committed
20
		    {% if facets.fields.categories %}
21
		    <ul class="custom padded">
fred's avatar
fred committed
22
				<li><span class="mainLabel">Genre :</span></li>
Simon Daron's avatar
Simon Daron committed
23
		      {# Provide only the top 5 categories #}
24
25
26
				{% for category in facets.fields.categories|slice:":5" %}
				<li>
					  {% if category.0 in selected_categories %}
fred's avatar
fred committed
27
					  	<a class="check icon-check" href="{{ request.get_full_path|remove_category_facet:category.0 }}">
Simon Daron's avatar
Simon Daron committed
28
							{{ category.0 }} <span class="smooth">| {{ category.1 }}</span>
29
30
						</a>
					  {% else %}
fred's avatar
fred committed
31
						<a class="check icon-check-empty" href="{{ request.get_full_path|append_category_facet:category.0 }}"
Simon Daron's avatar
Simon Daron committed
32
                            >{{ category.0 }} <span class="smooth">| {{ category.1 }}</span></a></span>
33
34
35
					  {% endif %}
				</li>
				{% endfor %}
Simon Daron's avatar
Simon Daron committed
36
37
38
		    </ul>
		    {% endif %}
		</nav>
39
		<nav>
Simon Daron's avatar
Simon Daron committed
40
		    {% if facets.fields.tags %}
41
		    <ul class="tag-facets custom padded">
fred's avatar
fred committed
42
				<li><span class="mainLabel">Mots-clés :</span></li>
Simon Daron's avatar
Simon Daron committed
43
44
45
46
		      {# Provide only the top 5 tags #}
			{% for tag in facets.fields.tags|slice:":20" %}
			<li>
			  {% if tag.0 in selected_tags %}
fred's avatar
fred committed
47
				<a class="check icon-check" href="{{ request.get_full_path|remove_tag_facet:tag.0 }}">
Simon Daron's avatar
Simon Daron committed
48
					{{ tag.0 }} <span class="smooth">| {{ tag.1 }}</span>
Simon Daron's avatar
Simon Daron committed
49
50
				</a> 
			  {% else %}
fred's avatar
fred committed
51
			    	<a class="check icon-check-empty" href="{{ request.get_full_path|append_tag_facet:tag.0 }}">{{ tag.0 }} <span class="smooth">| {{ tag.1 }}</span></a>
Simon Daron's avatar
Simon Daron committed
52
53
54
55
56
			  {% endif %}
			</li>
			{% endfor %}
		    </ul>
		    {% endif %}
fred's avatar
fred committed
57

Simon Daron's avatar
Simon Daron committed
58
59
		</nav>
	{% endif %}
60
    </div>
Simon Daron's avatar
Simon Daron committed
61
</div>
fred's avatar
fred committed
62
63
64
65
{% endblock %}


{% block main %}
fred's avatar
fred committed
66
	{% if query or selected_tags %}
Simon Daron's avatar
Simon Daron committed
67
<div class="wrapper">
68
	<div class="marged">
Simon Daron's avatar
Simon Daron committed
69
		{% if not page.object_list %}
fred's avatar
fred committed
70
			<div class="big error center">Manque de pot, pas de résultats à cette recherche !</div>
Simon Daron's avatar
Simon Daron committed
71
		{% endif %}
Simon Daron's avatar
Simon Daron committed
72
73
74
75
76
		{% 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
77

78
		<ul id="search-results" class="custom list columns cf padded">
fred's avatar
fred committed
79
80


Simon Daron's avatar
Simon Daron committed
81
		{% for result in page.object_list %}
Simon Daron's avatar
Simon Daron committed
82
				{% if result.object.title %}
Simon Daron's avatar
Simon Daron committed
83
			<li class="ellipsis">
Simon Daron's avatar
Simon Daron committed
84
					{% search_result_template result %}
Simon Daron's avatar
Simon Daron committed
85
			</li>
Simon Daron's avatar
Simon Daron committed
86
				{% endif %}
Simon Daron's avatar
Simon Daron committed
87
		{% endfor %}
fred's avatar
fred committed
88
89


Simon Daron's avatar
Simon Daron committed
90
91
92
93
94
95
		</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
96
	</div>
Simon Daron's avatar
Simon Daron committed
97
</div>
Simon Daron's avatar
Simon Daron committed
98
	{% endif %}
fred's avatar
fred committed
99
{% endblock %}