1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 20:17:45 +01:00

Merge pull request #340 from MrPaulBlack/simple-preferences-refactor

Simple theme preferences refactor
This commit is contained in:
Alexandre Flament 2021-09-24 20:19:03 +02:00 committed by GitHub
commit 636215b1f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 193 additions and 145 deletions

View File

@ -1844,6 +1844,11 @@ td:hover .engine-tooltip,
.column-reliability .engine-tooltip { .column-reliability .engine-tooltip {
right: 12rem; right: 12rem;
} }
#tab-contentquery table td,
#tab-contentquery table th {
text-align: left !important;
height: 3rem;
}
#main_preferences form { #main_preferences form {
width: 100%; width: 100%;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1844,6 +1844,11 @@ td:hover .engine-tooltip,
.column-reliability .engine-tooltip { .column-reliability .engine-tooltip {
right: 12rem; right: 12rem;
} }
#tab-contentquery table td,
#tab-contentquery table th {
text-align: left !important;
height: 3rem;
}
#main_preferences form { #main_preferences form {
width: 100%; width: 100%;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,12 @@
} }
} }
#tab-contentquery table td,
#tab-contentquery table th {
text-align: left !important;
height: 3rem;
}
#main_preferences { #main_preferences {
form { form {
width: 100%; width: 100%;

View File

@ -102,79 +102,147 @@
{{ tabs_open() }} {{ tabs_open() }}
{{ tab_header('maintab', 'general', _('General')) }} {{ tab_header('maintab', 'general', _('General')) }}
{% if 'categories' not in locked_preferences %} {% if 'categories' not in locked_preferences %}
<fieldset> <fieldset>
<legend>{{ _('Default categories') }}</legend> <legend>{{ _('Default categories') }}</legend>
{% set display_tooltip = false %} {% set display_tooltip = false %}
{% include 'simple/categories.html' %} {% include 'simple/categories.html' %}
</fieldset> </fieldset>
{% endif %} {% endif %}
{% if 'language' not in locked_preferences %} {% if 'language' not in locked_preferences %}
<fieldset> <fieldset>
<legend>{{ _('Search language') }}</legend> <legend>{{ _('Search language') }}</legend>
<p class="value">{{- '' -}} <p class="value">{{- '' -}}
<select name='language'>{{- '' -}} <select name='language'>{{- '' -}}
<option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Default language') }}</option> <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Default language') }}</option>
{%- for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) -%} {%- for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) -%}
<option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }}</option> <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }}</option>
{%- endfor -%}
</select>{{- '' -}}
</p>
<div class="description">{{ _('What language do you prefer for search?') }}</div>
</fieldset>
{% endif %}
{% if 'autocomplete' not in locked_preferences %}
<fieldset>
<legend>{{ _('Autocomplete') }}</legend>
<p class="value">
<select name="autocomplete">
<option value=""> - </option>
{%- for backend in autocomplete_backends -%}
<option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
{%- endfor -%}
</select>
</p>
<div class="description">{{ _('Find stuff as you type') }}</div>
</fieldset>
{% endif %}
{% if 'safesearch' not in locked_preferences %}
<fieldset>
<legend>{{ _('SafeSearch') }}</legend>
<p class="value">
<select name='safesearch'>
<option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
<option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
<option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
</select>
</p>
<p class="description">{{ _('Filter content') }}</p>
</fieldset>
{% endif %}
{{ plugin_preferences('general') }}
{% if 'doi_resolver' not in locked_preferences %}
<fieldset>
<legend>{{ _('Open Access DOI resolver') }}</legend>
<p class="value">
<select id='doi_resolver' name='doi_resolver'>
{%- for doi_resolver_name,doi_resolver_url in doi_resolvers.items() -%}
<option value="{{ doi_resolver_name }}" {% if doi_resolver_url == current_doi_resolver %}selected="selected"{% endif %}>
{{- doi_resolver_name }} - {{ doi_resolver_url -}}
</option>
{%- endfor -%} {%- endfor -%}
</select>{{- '' -}} </select>
</p> </p>
<div class="description">{{ _('What language do you prefer for search?') }}</div> <div class="description"><!-- {{ _('Redirect to open-access versions of publications when available (plugin required)') }} --></div>
</fieldset> </fieldset>
{% endif %} {% endif %}
{% if 'autocomplete' not in locked_preferences %} {{ tab_footer() }}
<fieldset>
<legend>{{ _('Autocomplete') }}</legend> {{ tab_header('maintab', 'ui', _('User interface')) }}
<p class="value"> {% if 'locale' not in locked_preferences %}
<select name="autocomplete"> <fieldset>
<option value=""> - </option> <legend>{{ _('Interface language') }}</legend>
{%- for backend in autocomplete_backends -%} <p class="value">
<option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option> <select name='locale'>
{%- endfor -%} {% for locale_id,locale_name in locales.items() | sort %}
</select> <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
</p> {% endfor %}
<div class="description">{{ _('Find stuff as you type') }}</div> </select>
</fieldset> </p>
{% endif %} <div class="description">{{ _('Change the language of the layout') }}</div>
{% if 'safesearch' not in locked_preferences %} </fieldset>
<fieldset> {% endif %}
<legend>{{ _('SafeSearch') }}</legend> {% if 'theme' not in locked_preferences %}
<p class="value"> <fieldset>
<select name='safesearch'> <legend>{{ _('Themes') }}</legend>
<option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option> <p class="value">
<option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option> <select name="theme">
<option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option> {%- for name in themes -%}
</select> <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
</p> {%- endfor -%}
<p class="description">{{ _('Filter content') }}</p> </select>
</fieldset> </p>
{% endif %} <div class="description">{{ _('Change searx layout') }}</div>
{{ plugin_preferences('general') }} </fieldset>
{% if 'doi_resolver' not in locked_preferences %} {% endif %}
<fieldset> {% if 'results_on_new_tab' not in locked_preferences %}
<legend>{{ _('Open Access DOI resolver') }}</legend> <fieldset>
<p class="value"> <legend>{{ _('Results on new tabs') }}</legend>
<select id='doi_resolver' name='doi_resolver'> <p class="value">
{%- for doi_resolver_name,doi_resolver_url in doi_resolvers.items() -%} <select name='results_on_new_tab'>
<option value="{{ doi_resolver_name }}" {% if doi_resolver_url == current_doi_resolver %}selected="selected"{% endif %}> <option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option>
{{- doi_resolver_name }} - {{ doi_resolver_url -}} <option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option>
</option> </select>
{%- endfor -%} </p>
</select> <div class="description">{{_('Open result links on new browser tabs') }}</div>
</p> </fieldset>
<div class="description"><!-- {{ _('Redirect to open-access versions of publications when available (plugin required)') }} --></div> {% endif %}
</fieldset> {{ plugin_preferences('ui') }}
{% endif %} {{ tab_footer() }}
{{ tab_header('maintab', 'privacy', _('Privacy')) }}
{% if 'method' not in locked_preferences %}
<fieldset>
<legend>{{ _('Method') }}</legend>
<p class="value">
<select name='method'>
<option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
<option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
</select>
</p>
<div class="description">{{ _('Search language') }}</div>
</fieldset>
{% endif %}
{% if 'image_proxy' not in locked_preferences %}
<fieldset>
<legend>{{ _('Image proxy') }}</legend>
<p class="value">
<select name='image_proxy'>
<option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
<option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled') }}</option>
</select>
</p>
<div class="description">{{ _('Proxying image results through searx') }}</div>
</fieldset>
{% endif %}
{{ plugin_preferences('privacy') }}
{{ tab_footer() }} {{ tab_footer() }}
{{ tab_header('maintab', 'engines', _('Engines')) }} {{ tab_header('maintab', 'engines', _('Engines')) }}
<p>{{ _('Currently used search engines') }}</p> <p>{{ _('Currently used search engines') }}</p>
{{ tabs_open() }} {{ tabs_open() }}
{% for categ in all_categories %} {% for categ in all_categories %}
{{ tab_header('enginetab', 'category' + categ, _(categ)) }} {{ tab_header('enginetab', 'category' + categ, _(categ)) }}
<div class="scrollx"> <div class="scrollx">
<table class="striped"> <table class="striped">
@ -190,7 +258,6 @@
<th>{{ _("Reliablity") }}</th> <th>{{ _("Reliablity") }}</th>
</tr> </tr>
{% for search_engine in engines_by_category[categ] %} {% for search_engine in engines_by_category[categ] %}
{% if not search_engine.private %} {% if not search_engine.private %}
{% set engine_id = 'engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_') %} {% set engine_id = 'engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_') %}
<tr> <tr>
@ -213,55 +280,51 @@
{{ tabs_close() }} {{ tabs_close() }}
{{ tab_footer() }} {{ tab_footer() }}
{{ tab_header('maintab', 'ui', _('User interface')) }} {{ tab_header('maintab', 'query', _('Special Queries')) }}
{% if 'locale' not in locked_preferences %} {% if answerers %}
<fieldset> <div class="scrollx">
<legend>{{ _('Interface language') }}</legend> <table class="striped">
<p class="value"> <tr>
<select name='locale'> <th>{{ _('Allow') }}</th>
{% for locale_id,locale_name in locales.items() | sort %} <th>{{ _('Keywords') }}</th>
<option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option> <th>{{ _('Name') }}</th>
{% endfor %} <th>{{ _('Description') }}</th>
</select> <th>{{ _('Examples') }}</th>
</p> </tr>
<div class="description">{{ _('Change the language of the layout') }}</div> <td></td>
</fieldset> <th scope="colgroup" colspan="4">{{ _('This is the list of searx\'s instant answering modules.') }}</th>
{% endif %} {% for answerer in answerers %}
{% if 'theme' not in locked_preferences %} <tr>
<fieldset> <td></td>
<legend>{{ _('Themes') }}</legend> <td>{{ answerer.keywords|join(', ') }}</td>
<p class="value"> <td>{{ answerer.info.name }}</td>
<select name="theme"> <td>{{ answerer.info.description }}</td>
{%- for name in themes -%} <td>{{ answerer.info.examples|join(', ') }}</td>
<option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option> </tr>
{%- endfor -%} {% endfor %}
</select> <td></td>
</p> <th scope="colgroup" colspan="4">{{ _('This is the list of plugins.') }}</th>
<div class="description">{{ _('Change searx layout') }}</div> {%- for plugin in plugins -%}
</fieldset> {%- if plugin.preference_section == 'query' -%}
{% endif %} <tr>
{% if 'results_on_new_tab' not in locked_preferences %} <td>{{- checkbox_onoff('plugin_' + plugin.id, plugin.id not in allowed_plugins) -}}</td>
<fieldset> <td>{{ plugin.query_keywords|join(', ') }}</td>
<legend>{{ _('Results on new tabs') }}</legend> <td>{{ _(plugin.name) }}</td>
<p class="value"> <td>{{ _(plugin.description) }}</td>
<select name='results_on_new_tab'> <td>{{ plugin.query_examples }}</td>
<option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option> </tr>
<option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option> {%- endif -%}
</select> {%- endfor -%}
</p> </table>
<div class="description">{{_('Open result links on new browser tabs') }}</div> </div>
</fieldset> {% endif %}
{% endif %}
{{ plugin_preferences('ui') }}
{{ tab_footer() }} {{ tab_footer() }}
{{ tab_header('maintab', 'cookies', _('Cookies')) }} {{ tab_header('maintab', 'cookies', _('Cookies')) }}
<p class="text-muted"> <p class="text-muted">
{{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br /> {{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br />
{{ _('With that list, you can assess searx transparency.') }}<br /> {{ _('With that list, you can assess searx transparency.') }}<br />
</p> </p>
{% if cookies %} {% if cookies %}
<table class="cookies"> <table class="cookies">
<tr> <tr>
@ -278,45 +341,14 @@
{% else %} {% else %}
{% include 'oscar/messages/no_cookies.html' %} {% include 'oscar/messages/no_cookies.html' %}
{% endif %} {% endif %}
<h4>{{ _('Search URL of the currently saved preferences') }} :</h4> <h4>{{ _('Search URL of the currently saved preferences') }} :</h4>
<div class="selectable_url"> <div class="selectable_url">
<pre>{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}</pre> <pre>{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}</pre>
</div> </div>
<p class="small_font">{{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }}</p> <p class="small_font">{{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }}</p>
{{ tab_footer() }} {{ tab_footer() }}
{{ tab_header('maintab', 'privacy', _('Privacy')) }} {{ tabs_close() }}
{% if 'method' not in locked_preferences %}
<fieldset>
<legend>{{ _('Method') }}</legend>
<p class="value">
<select name='method'>
<option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
<option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
</select>
</p>
<div class="description">{{ _('Search language') }}</div>
</fieldset>
{% endif %}
{% if 'image_proxy' not in locked_preferences %}
<fieldset>
<legend>{{ _('Image proxy') }}</legend>
<p class="value">
<select name='image_proxy'>
<option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
<option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled') }}</option>
</select>
</p>
<div class="description">{{ _('Proxying image results through searx') }}</div>
</fieldset>
{% endif %}
{{ plugin_preferences('privacy') }}
{{ tab_footer() }}
{{ tabs_close() }}
<p class="small_font">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }} <p class="small_font">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }}
<br /> <br />