1
0
mirror of https://github.com/searxng/searxng.git synced 2024-09-29 16:10:16 +02:00

[feat] settings: replace boolean select preferences with checkboxes

This commit is contained in:
Bnyro 2023-08-20 14:03:03 +02:00 committed by Markus Heiser
parent 5a5cfc1930
commit e5535ec078
6 changed files with 52 additions and 27 deletions

View File

@ -383,7 +383,8 @@ class Preferences:
'0': False, '0': False,
'1': True, '1': True,
'True': True, 'True': True,
'False': False 'False': False,
'on': True
} }
), ),
'method': EnumStringSetting( 'method': EnumStringSetting(
@ -412,7 +413,8 @@ class Preferences:
'0': False, '0': False,
'1': True, '1': True,
'False': False, 'False': False,
'True': True 'True': True,
'on': True
} }
), ),
'doi_resolver': MultipleChoiceSetting( 'doi_resolver': MultipleChoiceSetting(
@ -432,7 +434,8 @@ class Preferences:
'0': False, '0': False,
'1': True, '1': True,
'False': False, 'False': False,
'True': True 'True': True,
'on': True
} }
), ),
'advanced_search': MapSetting( 'advanced_search': MapSetting(
@ -454,7 +457,8 @@ class Preferences:
'0': False, '0': False,
'1': True, '1': True,
'True': True, 'True': True,
'False': False 'False': False,
'on': True
} }
), ),
'infinite_scroll': MapSetting( 'infinite_scroll': MapSetting(
@ -465,7 +469,8 @@ class Preferences:
'0': False, '0': False,
'1': True, '1': True,
'True': True, 'True': True,
'False': False 'False': False,
'on': True
} }
), ),
# fmt: on # fmt: on

View File

@ -1,10 +1,14 @@
<fieldset>{{- '' -}} <fieldset>{{- '' -}}
<legend id="pref_center_alignment">{{ _('Center Alignment') }}</legend>{{- '' -}} <legend id="pref_center_alignment">{{ _('Center Alignment') }}</legend>{{- '' -}}
<p class="value">{{- '' -}} <p class="value">{{- '' -}}
<select name="center_alignment" aria-labelledby="pref_center_alignment">{{- '' -}} <input type="checkbox" {{- ' ' -}}
<option value="1" {% if preferences.get_value('center_alignment') %}selected="selected"{% endif %}>{{ _('On') }}</option>{{- '' -}} name="center_alignment" {{- ' ' -}}
<option value="0" {% if not preferences.get_value('center_alignment') %}selected="selected"{% endif %}>{{ _('Off')}}</option>{{- '' -}} aria-labelledby="pref_center_alignment" {{- ' ' -}}
</select>{{- '' -}} class="checkbox-onoff" {{- ' ' -}}
{%- if preferences.get_value('center_alignment') -%}
checked
{%- endif -%}{{- ' ' -}}
/>{{- '' -}}
</p>{{- '' -}} </p>{{- '' -}}
<div class="description"> <div class="description">
{{- _('Displays results in the center of the page (Oscar layout).') -}} {{- _('Displays results in the center of the page (Oscar layout).') -}}

View File

@ -1,11 +1,15 @@
<fieldset>{{- '' -}} <fieldset>{{- '' -}}
<legend id="pref_image_proxy">{{ _('Image proxy') }}</legend>{{- '' -}} <legend id="pref_image_proxy">{{ _('Image proxy') }}</legend>{{- '' -}}
<p class="value">{{- '' -}} <p class="value">{{- '' -}}
<select name='image_proxy' aria-labelledby="pref_image_proxy">{{- '' -}} <input type="checkbox" {{- ' ' -}}
<option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>{{- '' -}} name="image_proxy" {{- ' ' -}}
<option value="0" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled') }}</option>{{- '' -}} aria-labelledby="pref_image_proxy" {{- ' ' -}}
</select>{{- '' -}} class="checkbox-onoff" {{- ' ' -}}
</p> {%- if preferences.get_value('image_proxy') -%}
checked
{%- endif -%}{{- ' ' -}}
/>{{- '' -}}
</p>{{- '' -}}
<div class="description"> <div class="description">
{{- _('Proxying image results through SearXNG') -}} {{- _('Proxying image results through SearXNG') -}}
</div>{{- '' -}} </div>{{- '' -}}

View File

@ -1,10 +1,14 @@
<fieldset>{{- '' -}} <fieldset>{{- '' -}}
<legend>{{ _('Infinite scroll') }}</legend>{{- '' -}} <legend>{{ _('Infinite scroll') }}</legend>{{- '' -}}
<p class="value">{{- '' -}} <p class="value">{{- '' -}}
<select name='infinite_scroll'>{{- '' -}} <input type="checkbox" {{- ' ' -}}
<option value="1" {% if infinite_scroll %}selected="selected"{% endif %}>{{ _('On') }}</option>{{- '' -}} name="infinite_scroll" {{- ' ' -}}
<option value="0" {% if not infinite_scroll %}selected="selected"{% endif %}>{{ _('Off')}}</option>{{- '' -}} aria-labelledby="pref_infinite_scroll" {{- ' ' -}}
</select>{{- '' -}} class="checkbox-onoff" {{- ' ' -}}
{%- if preferences.get_value('infinite_scroll') -%}
checked
{%- endif -%}{{- ' ' -}}
/>{{- '' -}}
</p>{{- '' -}} </p>{{- '' -}}
<div class="description"> <div class="description">
{{- _('Automatically load next page when scrolling to bottom of current page') -}} {{- _('Automatically load next page when scrolling to bottom of current page') -}}

View File

@ -1,10 +1,14 @@
<fieldset>{{- '' -}} <fieldset>{{- '' -}}
<legend id="pref_query_in_title">{{ _("Query in the page's title") }}</legend> <legend id="pref_query_in_title">{{ _("Query in the page's title") }}</legend>{{- '' -}}
<p class="value">{{- '' -}} <p class="value">{{- '' -}}
<select name='query_in_title' aria-labelledby="pref_query_in_title">{{- '' -}} <input type="checkbox" {{- ' ' -}}
<option value="1" {% if query_in_title %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>{{- '' -}} name="query_in_title" {{- ' ' -}}
<option value="0" {% if not query_in_title %}selected="selected"{% endif %}>{{ _('Disabled') }}</option>{{- '' -}} aria-labelledby="pref_query_in_title" {{- ' ' -}}
</select>{{- '' -}} class="checkbox-onoff" {{- ' ' -}}
{%- if preferences.get_value('query_in_title') -%}
checked
{%- endif -%}{{- ' ' -}}
/>{{- '' -}}
</p>{{- '' -}} </p>{{- '' -}}
<div class="description"> <div class="description">
{{- _("When enabled, the result page's title contains your query. Your browser can record this title") -}} {{- _("When enabled, the result page's title contains your query. Your browser can record this title") -}}

View File

@ -1,10 +1,14 @@
<fieldset>{{- '' -}} <fieldset>{{- '' -}}
<legend id="pref_results_on_new_tab">{{ _('Results on new tabs') }}</legend>{{- '' -}} <legend id="pref_results_on_new_tab">{{ _('Results on new tabs') }}</legend>{{- '' -}}
<p class="value">{{- '' -}} <p class="value">{{- '' -}}
<select name='results_on_new_tab' aria-labelledby="pref_results_on_new_tab">{{- '' -}} <input type="checkbox" {{- ' ' -}}
<option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option>{{- '' -}} name="results_on_new_tab" {{- ' ' -}}
<option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option>{{- '' -}} aria-labelledby="pref_results_on_new_tab" {{- ' ' -}}
</select>{{- '' -}} class="checkbox-onoff" {{- ' ' -}}
{%- if preferences.get_value('results_on_new_tab') -%}
checked
{%- endif -%}{{- ' ' -}}
/>{{- ' ' -}}
</p>{{- '' -}} </p>{{- '' -}}
<div class="description"> <div class="description">
{{- _('Open result links on new browser tabs') -}} {{- _('Open result links on new browser tabs') -}}