Commit 82d0b069 authored by fred's avatar fred
Browse files

search: include facets in previous & next links

parent 545644ec
...@@ -136,6 +136,8 @@ class SearchView(FacetedSearchView): ...@@ -136,6 +136,8 @@ class SearchView(FacetedSearchView):
def extra_context(self): def extra_context(self):
context = super(SearchView, self).extra_context() context = super(SearchView, self).extra_context()
context['sectionName'] = 'Search' context['sectionName'] = 'Search'
if self.request.GET.getlist('selected_facets'):
context['facets_qs'] = '&selected_facets=' + '&'.join(self.request.GET.getlist('selected_facets'))
context['selected_categories'] = [ context['selected_categories'] = [
x.split(':', 1)[1] for x in self.request.GET.getlist('selected_facets') x.split(':', 1)[1] for x in self.request.GET.getlist('selected_facets')
if x.startswith('categories_exact')] if x.startswith('categories_exact')]
...@@ -181,6 +183,8 @@ class ListenArchivesView(FacetedSearchView): ...@@ -181,6 +183,8 @@ class ListenArchivesView(FacetedSearchView):
def extra_context(self): def extra_context(self):
context = super(ListenArchivesView, self).extra_context() context = super(ListenArchivesView, self).extra_context()
context['sectionName'] = "Listen" context['sectionName'] = "Listen"
if self.request.GET.getlist('selected_facets'):
context['facets_qs'] = '&selected_facets=' + '&'.join(self.request.GET.getlist('selected_facets'))
context['selected_format'] = [ context['selected_format'] = [
x.split(':', 1)[1] for x in self.request.GET.getlist('selected_facets') x.split(':', 1)[1] for x in self.request.GET.getlist('selected_facets')
if x.startswith('format_exact')] if x.startswith('format_exact')]
...@@ -220,6 +224,8 @@ class NewsArchivesView(FacetedSearchView): ...@@ -220,6 +224,8 @@ class NewsArchivesView(FacetedSearchView):
def extra_context(self): def extra_context(self):
context = super(NewsArchivesView, self).extra_context() context = super(NewsArchivesView, self).extra_context()
if self.request.GET.getlist('selected_facets'):
context['facets_qs'] = '&selected_facets=' + '&'.join(self.request.GET.getlist('selected_facets'))
context['sectionName'] = 'News' context['sectionName'] = 'News'
context['selected_news_categories'] = [ context['selected_news_categories'] = [
x.split(':', 1)[1] for x in self.request.GET.getlist('selected_facets') x.split(':', 1)[1] for x in self.request.GET.getlist('selected_facets')
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
{% if page.has_previous %} {% if page.has_previous %}
<div class="previous-page cf"> <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> <a class="button big left" href="?q={{ query }}&amp;page={{ page.previous_page_number }}{{ facets_qs }}">&laquo; Résultats précédénts</a>
</div> </div>
{% endif %} {% endif %}
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
{% if page.has_next %} {% if page.has_next %}
<div class="next-page cf"> <div class="next-page cf">
<a class="button big right" href="?q={{ query }}&amp;page={{ page.next_page_number }}">Résultats suivants &raquo;</a> <a class="button big right" href="?q={{ query }}&amp;page={{ page.next_page_number }}{{ facets_qs }}">Résultats suivants &raquo;</a>
</div> </div>
{% endif %} {% endif %}
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
{% if page.has_previous %} {% if page.has_previous %}
<div class="previous-page cf"> <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> <a class="button big left" href="?q={{ query }}&amp;page={{ page.previous_page_number }}{{ facets_qs }}">&laquo; Résultats précédénts</a>
</div> </div>
{% endif %} {% endif %}
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
{% if page.has_next %} {% if page.has_next %}
<div class="next-page cf"> <div class="next-page cf">
<a class="button big right" href="?q={{ query }}&amp;page={{ page.next_page_number }}">Résultats suivants &raquo;</a> <a class="button big right" href="?q={{ query }}&amp;page={{ page.next_page_number }}{{ facets_qs }}">Résultats suivants &raquo;</a>
</div> </div>
{% endif %} {% endif %}
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
{% endif %} {% endif %}
{% if page.has_previous %} {% if page.has_previous %}
<div class="previous-page cf"> <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> <a class="button big left" href="?q={{ query }}&amp;page={{ page.previous_page_number }}{{ facets_qs }}">&laquo; Résultats précédénts</a>
</div> </div>
{% endif %} {% endif %}
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</ul> </ul>
{% if page.has_next %} {% if page.has_next %}
<div class="next-page cf"> <div class="next-page cf">
<a class="button big right" href="?q={{ query }}&amp;page={{ page.next_page_number }}">Résultats suivants &raquo;</a> <a class="button big right" href="?q={{ query }}&amp;page={{ page.next_page_number }}{{ facets_qs }}">Résultats suivants &raquo;</a>
</div> </div>
{% endif %} {% endif %}
</div> </div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment