]> git.0d.be Git - panikweb.git/blob - panikweb_templates/templates/search/search.html
Hide filters with 0 results
[panikweb.git] / panikweb_templates / templates / search / search.html
1 {% extends 'panikdb/base.html' %}
2 {% load paniktags %}
3 {% load highlight %}
4 {% block bodyID %}Search{% endblock %}
5 {% block title %}Recherche{% endblock %}
6 {% block nav %} 
7 <div class="mainSub">
8     <div class="wrapper">
9         <nav>
10         <form method="get" action="." class="big marged" id="search-form">
11                 {{ form.as_table }}<button class="icon-search"></button>
12         </form>
13         </nav>
14     </div>
15 </div>
16 <div class="wrapper">
17     <div class="newsFilters">
18         {% if query or selected_tags %}
19                 <nav class="">
20                     {% if facets.fields.categories %}
21                     <ul class="custom padded">
22                                 <li><span class="mainLabel">Genre:</span></li>
23                       {# Provide only the top 5 categories #}
24                                 {% for category in facets.fields.categories|slice:":5" %}
25                                 <li>
26                                           {% if category.0 in selected_categories %}
27                                                 <a class="check icon-check count-{{ category.1 }}" href="{{ request.get_full_path|remove_category_facet:category.0 }}">
28                                                         {{ category.0 }} | {{ category.1 }}
29                                                 </a>
30                                           {% else %}
31                                                 <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>
32                                           {% endif %}
33                                 </li>
34                                 {% endfor %}
35                     </ul>
36                     {% endif %}
37                 </nav>
38                 <nav>
39                     {% if facets.fields.tags %}
40                     <ul class="tag-facets custom padded">
41                                 <li><span class="mainLabel">Mots clés:</span></li>
42                       {# Provide only the top 5 tags #}
43                         {% for tag in facets.fields.tags|slice:":20" %}
44                         <li>
45                           {% if tag.0 in selected_tags %}
46                                 <a class="check icon-check count-{{ tag.1 }}" href="{{ request.get_full_path|remove_tag_facet:tag.0 }}">
47                                         {{ tag.0 }} | {{ tag.1 }}
48                                 </a> 
49                           {% else %}
50                                 <a class="check icon-check-empty count-{{ tag.1 }}" href="{{ request.get_full_path|append_tag_facet:tag.0 }}">{{ tag.0 }} | {{ tag.1 }}</a> 
51                           {% endif %}
52                         </li>
53                         {% endfor %}
54                     </ul>
55                     {% endif %}
56
57                 </nav>
58         {% endif %}
59     </div>
60 </div>
61 {% endblock %}
62
63
64 {% block main %}
65         {% if query or selected_tags %}
66 <div class="wrapper">
67         <div class="marged">
68                 {% if not page.object_list %}
69                         <div class="big error center">Sorry, no result with your query!</div>
70                 {% endif %}
71                 {% if page.has_previous %}
72                         <div class="previous-page cf">
73                                 <a class="button big left" href="?q={{ query }}&amp;page={{ page.previous_page_number }}">&laquo; Résultats précédénts</a>
74                         </div>
75                 {% endif %}
76
77                 <ul id="search-results" class="custom list columns cf padded">
78
79
80                 {% for result in page.object_list %}
81                                 {% if result.object.title %}
82                         <li class="ellipsis">
83                                         {% search_result_template result %}
84                         </li>
85                                 {% endif %}
86                 {% endfor %}
87
88
89                 </ul>
90                 {% if page.has_next %}
91                         <div class="next-page cf">
92                                 <a class="button big right" href="?q={{ query }}&amp;page={{ page.next_page_number }}">Résultats suivants &raquo;</a>
93                         </div>
94                 {% endif %}
95         </div>
96 </div>
97         {% endif %}
98 {% endblock %}