mirror of
https://github.com/searxng/searxng.git
synced 2024-11-22 12:10:11 +01:00
Add preference for displaying advanced settings
This commit is contained in:
parent
2fc3b17c85
commit
b00f77059c
@ -395,6 +395,15 @@ class Preferences:
|
|||||||
settings['ui'].get('theme_args', {}).get('oscar_style', 'logicodev'),
|
settings['ui'].get('theme_args', {}).get('oscar_style', 'logicodev'),
|
||||||
is_locked('oscar-style'),
|
is_locked('oscar-style'),
|
||||||
choices=['', 'logicodev', 'logicodev-dark', 'pointhi']),
|
choices=['', 'logicodev', 'logicodev-dark', 'pointhi']),
|
||||||
|
'advanced_search': MapSetting(
|
||||||
|
settings['ui'].get('advanced_search', False),
|
||||||
|
map={
|
||||||
|
'0': False,
|
||||||
|
'1': True,
|
||||||
|
'False': False,
|
||||||
|
'True': True
|
||||||
|
}
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
self.engines = EnginesSetting('engines', choices=engines)
|
self.engines = EnginesSetting('engines', choices=engines)
|
||||||
|
@ -140,6 +140,15 @@
|
|||||||
{{ preferences_item_footer(info, label, rtl) }}
|
{{ preferences_item_footer(info, label, rtl) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% set label = _('Show advanced settings') %}
|
||||||
|
{% set info = _('Show advanced settings panel in the home page by default') %}
|
||||||
|
{{ preferences_item_header(info, label, rtl, 'advanced_search') }}
|
||||||
|
<select class="form-control {{ custom_select_class(rtl) }}" name="advanced_search" id="advanced_search">
|
||||||
|
<option value="1" {% if preferences.get_value('advanced_search')%}selected="selected"{% endif %}>{{ _('On') }}</option>
|
||||||
|
<option value="0" {% if not preferences.get_value('advanced_search')%}selected="selected"{% endif %}>{{ _('Off')}}</option>
|
||||||
|
</select>
|
||||||
|
{{ preferences_item_footer(info, label, rtl) }}
|
||||||
|
|
||||||
{% if 'doi_resolver' not in locked_preferences %}
|
{% if 'doi_resolver' not in locked_preferences %}
|
||||||
{% set label = _('Open Access DOI resolver') %}
|
{% set label = _('Open Access DOI resolver') %}
|
||||||
{% set info = _('Redirect to open-access versions of publications when available (plugin required)') %}
|
{% set info = _('Redirect to open-access versions of publications when available (plugin required)') %}
|
||||||
|
@ -545,6 +545,9 @@ def index_error(output_format, error_message):
|
|||||||
def index():
|
def index():
|
||||||
"""Render index page."""
|
"""Render index page."""
|
||||||
|
|
||||||
|
# UI
|
||||||
|
advanced_search = request.form.get('advanced_search', request.preferences.get_value('advanced_search'))
|
||||||
|
|
||||||
# redirect to search if there's a query in the request
|
# redirect to search if there's a query in the request
|
||||||
if request.form.get('q'):
|
if request.form.get('q'):
|
||||||
query = ('?' + request.query_string.decode()) if request.query_string else ''
|
query = ('?' + request.query_string.decode()) if request.query_string else ''
|
||||||
@ -553,6 +556,7 @@ def index():
|
|||||||
return render(
|
return render(
|
||||||
'index.html',
|
'index.html',
|
||||||
selected_categories=get_selected_categories(request.preferences, request.form),
|
selected_categories=get_selected_categories(request.preferences, request.form),
|
||||||
|
advanced_search=advanced_search,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user