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 {
right: 12rem;
}
#tab-contentquery table td,
#tab-contentquery table th {
text-align: left !important;
height: 3rem;
}
#main_preferences form {
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 {
right: 12rem;
}
#tab-contentquery table td,
#tab-contentquery table th {
text-align: left !important;
height: 3rem;
}
#main_preferences form {
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 {
form {
width: 100%;

View File

@ -169,50 +169,6 @@
{% endif %}
{{ tab_footer() }}
{{ tab_header('maintab', 'engines', _('Engines')) }}
<p>{{ _('Currently used search engines') }}</p>
{{ tabs_open() }}
{% for categ in all_categories %}
{{ tab_header('enginetab', 'category' + categ, _(categ)) }}
<div class="scrollx">
<table class="striped">
<tr>
<th class="engine_checkbox">{{ _("Allow") }}</th>
<th class="name">{{ _("Engine name") }}</th>
<th class="shortcut">{{ _("Shortcut") }}</th>
<th>{{ _("Supports selected language") }}</th>
<th>{{ _("SafeSearch") }}</th>
<th>{{ _("Time range") }}</th>
<th>{{ _("Response time") }}</th>
<th>{{ _("Max time") }}</th>
<th>{{ _("Reliablity") }}</th>
</tr>
{% for search_engine in engines_by_category[categ] %}
{% if not search_engine.private %}
{% set engine_id = 'engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_') %}
<tr>
<td class="engine_checkbox">{{ checkbox_onoff(engine_id, (search_engine.name, categ) in disabled_engines) }}</td>
<th class="name">{% if search_engine.enable_http %}{{ icon('warning', 'No HTTPS') }}{% endif %} {{ search_engine.name }} {{ engine_about(search_engine) }}</th>
<td class="shortcut">{{ shortcuts[search_engine.name] }}</td>
<td>{{ checkbox(engine_id + '_supported_languages', supports[search_engine.name]['supports_selected_language'], true, true) }}</td>
<td>{{ checkbox(engine_id + '_safesearch', supports[search_engine.name]['safesearch'], true, true) }}</td>
<td>{{ checkbox(engine_id + '_time_range_support', supports[search_engine.name]['time_range_support'], true, true) }}</td>
{{ engine_time(search_engine.name) }}
<td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
{{ engine_reliability(search_engine.name) }}
</tr>
{% endif %}
{% endfor %}
</table>
</div>
{{ tab_footer() }}
{% endfor %}
{{ tabs_close() }}
{{ tab_footer() }}
{{ tab_header('maintab', 'ui', _('User interface')) }}
{% if 'locale' not in locked_preferences %}
<fieldset>
@ -255,38 +211,6 @@
{{ plugin_preferences('ui') }}
{{ tab_footer() }}
{{ tab_header('maintab', 'cookies', _('Cookies')) }}
<p class="text-muted">
{{ _('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 />
</p>
{% if cookies %}
<table class="cookies">
<tr>
<th>{{ _('Cookie name') }}</th>
<th>{{ _('Value') }}</th>
</tr>
{% for cookie in cookies %}
<tr>
<td>{{ cookie }}</td>
<td>{{ cookies[cookie] }}</td>
</tr>
{% endfor %}
</table>
{% else %}
{% include 'oscar/messages/no_cookies.html' %}
{% endif %}
<h4>{{ _('Search URL of the currently saved preferences') }} :</h4>
<div class="selectable_url">
<pre>{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}</pre>
</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>
{{ tab_footer() }}
{{ tab_header('maintab', 'privacy', _('Privacy')) }}
{% if 'method' not in locked_preferences %}
<fieldset>
@ -313,7 +237,115 @@
</fieldset>
{% endif %}
{{ plugin_preferences('privacy') }}
{{ tab_footer() }}
{{ tab_header('maintab', 'engines', _('Engines')) }}
<p>{{ _('Currently used search engines') }}</p>
{{ tabs_open() }}
{% for categ in all_categories %}
{{ tab_header('enginetab', 'category' + categ, _(categ)) }}
<div class="scrollx">
<table class="striped">
<tr>
<th class="engine_checkbox">{{ _("Allow") }}</th>
<th class="name">{{ _("Engine name") }}</th>
<th class="shortcut">{{ _("Shortcut") }}</th>
<th>{{ _("Supports selected language") }}</th>
<th>{{ _("SafeSearch") }}</th>
<th>{{ _("Time range") }}</th>
<th>{{ _("Response time") }}</th>
<th>{{ _("Max time") }}</th>
<th>{{ _("Reliablity") }}</th>
</tr>
{% for search_engine in engines_by_category[categ] %}
{% if not search_engine.private %}
{% set engine_id = 'engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_') %}
<tr>
<td class="engine_checkbox">{{ checkbox_onoff(engine_id, (search_engine.name, categ) in disabled_engines) }}</td>
<th class="name">{% if search_engine.enable_http %}{{ icon('warning', 'No HTTPS') }}{% endif %} {{ search_engine.name }} {{ engine_about(search_engine) }}</th>
<td class="shortcut">{{ shortcuts[search_engine.name] }}</td>
<td>{{ checkbox(engine_id + '_supported_languages', supports[search_engine.name]['supports_selected_language'], true, true) }}</td>
<td>{{ checkbox(engine_id + '_safesearch', supports[search_engine.name]['safesearch'], true, true) }}</td>
<td>{{ checkbox(engine_id + '_time_range_support', supports[search_engine.name]['time_range_support'], true, true) }}</td>
{{ engine_time(search_engine.name) }}
<td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
{{ engine_reliability(search_engine.name) }}
</tr>
{% endif %}
{% endfor %}
</table>
</div>
{{ tab_footer() }}
{% endfor %}
{{ tabs_close() }}
{{ tab_footer() }}
{{ tab_header('maintab', 'query', _('Special Queries')) }}
{% if answerers %}
<div class="scrollx">
<table class="striped">
<tr>
<th>{{ _('Allow') }}</th>
<th>{{ _('Keywords') }}</th>
<th>{{ _('Name') }}</th>
<th>{{ _('Description') }}</th>
<th>{{ _('Examples') }}</th>
</tr>
<td></td>
<th scope="colgroup" colspan="4">{{ _('This is the list of searx\'s instant answering modules.') }}</th>
{% for answerer in answerers %}
<tr>
<td></td>
<td>{{ answerer.keywords|join(', ') }}</td>
<td>{{ answerer.info.name }}</td>
<td>{{ answerer.info.description }}</td>
<td>{{ answerer.info.examples|join(', ') }}</td>
</tr>
{% endfor %}
<td></td>
<th scope="colgroup" colspan="4">{{ _('This is the list of plugins.') }}</th>
{%- for plugin in plugins -%}
{%- if plugin.preference_section == 'query' -%}
<tr>
<td>{{- checkbox_onoff('plugin_' + plugin.id, plugin.id not in allowed_plugins) -}}</td>
<td>{{ plugin.query_keywords|join(', ') }}</td>
<td>{{ _(plugin.name) }}</td>
<td>{{ _(plugin.description) }}</td>
<td>{{ plugin.query_examples }}</td>
</tr>
{%- endif -%}
{%- endfor -%}
</table>
</div>
{% endif %}
{{ tab_footer() }}
{{ tab_header('maintab', 'cookies', _('Cookies')) }}
<p class="text-muted">
{{ _('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 />
</p>
{% if cookies %}
<table class="cookies">
<tr>
<th>{{ _('Cookie name') }}</th>
<th>{{ _('Value') }}</th>
</tr>
{% for cookie in cookies %}
<tr>
<td>{{ cookie }}</td>
<td>{{ cookies[cookie] }}</td>
</tr>
{% endfor %}
</table>
{% else %}
{% include 'oscar/messages/no_cookies.html' %}
{% endif %}
<h4>{{ _('Search URL of the currently saved preferences') }} :</h4>
<div class="selectable_url">
<pre>{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}</pre>
</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>
{{ tab_footer() }}
{{ tabs_close() }}