advanced-search: panel is visible when checked before

This commit is contained in:
Noemi Vanyi 2016-07-25 22:47:55 +02:00
parent 128b5245ab
commit 16a8641649
3 changed files with 5 additions and 1 deletions

View File

@ -139,6 +139,7 @@ class Search(object):
self.pageno = 1 self.pageno = 1
self.lang = 'all' self.lang = 'all'
self.time_range = None self.time_range = None
self.is_advanced = None
# set blocked engines # set blocked engines
self.disabled_engines = request.preferences.engines.get_disabled() self.disabled_engines = request.preferences.engines.get_disabled()
@ -180,6 +181,7 @@ class Search(object):
self.lang = query_obj.languages[-1] self.lang = query_obj.languages[-1]
self.time_range = self.request_data.get('time_range') self.time_range = self.request_data.get('time_range')
self.is_advanced = self.request_data.get('advanced_search')
self.engines = query_obj.engines self.engines = query_obj.engines
@ -298,6 +300,7 @@ class Search(object):
# 0 = None, 1 = Moderate, 2 = Strict # 0 = None, 1 = Moderate, 2 = Strict
request_params['safesearch'] = request.preferences.get_value('safesearch') request_params['safesearch'] = request.preferences.get_value('safesearch')
request_params['time_range'] = self.time_range request_params['time_range'] = self.time_range
request_params['advanced_search'] = self.is_advanced
# update request parameters dependent on # update request parameters dependent on
# search-engine (contained in engines folder) # search-engine (contained in engines folder)

View File

@ -1,5 +1,5 @@
<div class="input-group col-sm-12 advanced"> <div class="input-group col-sm-12 advanced">
<input type="checkbox" id="check-advanced"> <input type="checkbox" name="advanced_search" id="check-advanced" {% if advanced_search %} checked="checked"{% endif %}>
<label for="check-advanced"> <label for="check-advanced">
<span class="glyphicon glyphicon-cog"></span> <span class="glyphicon glyphicon-cog"></span>
{{ _('Advanced settings') }} {{ _('Advanced settings') }}

View File

@ -459,6 +459,7 @@ def index():
paging=search.paging, paging=search.paging,
number_of_results=format_decimal(number_of_results), number_of_results=format_decimal(number_of_results),
pageno=search.pageno, pageno=search.pageno,
advanced_search=search.is_advanced,
time_range=search.time_range, time_range=search.time_range,
base_url=get_base_url(), base_url=get_base_url(),
suggestions=search.result_container.suggestions, suggestions=search.result_container.suggestions,