fix selects in preferences so they look consistent (#2150)

This commit is contained in:
Marc Abonce Seguin 2020-08-27 19:55:47 +00:00 committed by GitHub
parent 0d8970c8f2
commit a2430154b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 17 deletions

View file

@ -412,7 +412,8 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
background-color: #068922; background-color: #068922;
color: white; color: white;
} }
.custom-select { .custom-select,
.custom-select-rtl {
appearance: none; appearance: none;
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
@ -430,6 +431,9 @@ ZQAyMDE2LTA3LTI0VDExOjU1OjU4KzAyOjAwRFqFOQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNi0w
Ny0yNFQxMToxNTowMCswMjowMP7RDgQAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb Ny0yNFQxMToxNTowMCswMjowMP7RDgQAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb
7jwaAAAAAElFTkSuQmCC) 96% no-repeat; 7jwaAAAAAElFTkSuQmCC) 96% no-repeat;
} }
.custom-select-rtl {
background-position-x: 4%;
}
.search-margin { .search-margin {
margin-bottom: 0.6em; margin-bottom: 0.6em;
} }

File diff suppressed because one or more lines are too long

View file

@ -385,7 +385,8 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
background-color: #068922; background-color: #068922;
color: white; color: white;
} }
.custom-select { .custom-select,
.custom-select-rtl {
appearance: none; appearance: none;
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
@ -403,6 +404,9 @@ ZQAyMDE2LTA3LTI0VDExOjU1OjU4KzAyOjAwRFqFOQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNi0w
Ny0yNFQxMToxNTowMCswMjowMP7RDgQAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb Ny0yNFQxMToxNTowMCswMjowMP7RDgQAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb
7jwaAAAAAElFTkSuQmCC) 96% no-repeat; 7jwaAAAAAElFTkSuQmCC) 96% no-repeat;
} }
.custom-select-rtl {
background-position-x: 4%;
}
.search-margin { .search-margin {
margin-bottom: 0.6em; margin-bottom: 0.6em;
} }

File diff suppressed because one or more lines are too long

View file

@ -56,7 +56,7 @@
color: white; color: white;
} }
.custom-select { .custom-select, .custom-select-rtl {
appearance: none; appearance: none;
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
@ -75,6 +75,10 @@ Ny0yNFQxMToxNTowMCswMjowMP7RDgQAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb
7jwaAAAAAElFTkSuQmCC) 96% no-repeat; 7jwaAAAAAElFTkSuQmCC) 96% no-repeat;
} }
.custom-select-rtl {
background-position-x: 4%;
}
.search-margin { .search-margin {
margin-bottom: 0.6em; margin-bottom: 0.6em;
} }

View file

@ -1,5 +1,6 @@
{% from 'oscar/macros.html' import custom_select_class %}
<label class="visually-hidden" for="language">{{ _('Language') }}</label> <label class="visually-hidden" for="language">{{ _('Language') }}</label>
<select class="language custom-select form-control" id="language" name="language" accesskey="l"> <select class="language form-control {{ custom_select_class(rtl) }}" id="language" name="language" accesskey="l">
<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 %}> <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>

View file

@ -84,6 +84,10 @@
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
{% macro custom_select_class(rtl) -%}
custom-select{% if rtl %}-rtl{% endif %}
{%- endmacro %}
{% macro checkbox_toggle(id, blocked) -%} {% macro checkbox_toggle(id, blocked) -%}
<div class="onoffswitch"> <div class="onoffswitch">
<input type="checkbox" id="{{ id }}" name="{{ id }}"{% if blocked %} checked="checked"{% endif %} class="onoffswitch-checkbox"> <input type="checkbox" id="{{ id }}" name="{{ id }}"{% if blocked %} checked="checked"{% endif %} class="onoffswitch-checkbox">

View file

@ -1,4 +1,4 @@
{% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl, checkbox_toggle, support_toggle %} {% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl, checkbox_toggle, support_toggle, custom_select_class %}
{% extends "oscar/base.html" %} {% extends "oscar/base.html" %}
{% block title %}{{ _('preferences') }} - {% endblock %} {% block title %}{{ _('preferences') }} - {% endblock %}
{% block content %} {% block content %}
@ -47,7 +47,7 @@
{% set locale_label = _('Interface language') %} {% set locale_label = _('Interface language') %}
{% set locale_info = _('Change the language of the layout') %} {% set locale_info = _('Change the language of the layout') %}
{{ preferences_item_header(locale_info, locale_label, rtl, 'locale') }} {{ preferences_item_header(locale_info, locale_label, rtl, 'locale') }}
<select class="form-control" name="locale" id="locale"> <select class="form-control {{ custom_select_class(rtl)}}" name="locale" id="locale">
{% for locale_id,locale_name in locales.items() | sort %} {% for locale_id,locale_name in locales.items() | sort %}
<option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option> <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
{% endfor %} {% endfor %}
@ -57,7 +57,7 @@
{% set autocomplete_label = _('Autocomplete') %} {% set autocomplete_label = _('Autocomplete') %}
{% set autocomplete_info = _('Find stuff as you type') %} {% set autocomplete_info = _('Find stuff as you type') %}
{{ preferences_item_header(autocomplete_info, autocomplete_label, rtl, 'autocomplete') }} {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl, 'autocomplete') }}
<select class="form-control" name="autocomplete" id="autocomplete"> <select class="form-control {{ custom_select_class(rtl) }}" name="autocomplete" id="autocomplete">
<option value=""> - </option> <option value=""> - </option>
{% for backend in autocomplete_backends %} {% for backend in autocomplete_backends %}
<option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option> <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
@ -68,7 +68,7 @@
{% set image_proxy_label = _('Image proxy') %} {% set image_proxy_label = _('Image proxy') %}
{% set image_proxy_info = _('Proxying image results through searx') %} {% set image_proxy_info = _('Proxying image results through searx') %}
{{ preferences_item_header(image_proxy_info, image_proxy_label, rtl, 'image_proxy') }} {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl, 'image_proxy') }}
<select class="form-control" name="image_proxy" id="image_proxy"> <select class="form-control {{ custom_select_class(rtl) }}" name="image_proxy" id="image_proxy">
<option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option> <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
<option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option> <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option>
</select> </select>
@ -77,7 +77,7 @@
{% set method_label = _('Method') %} {% set method_label = _('Method') %}
{% set method_info = _('Change how forms are submited, <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" rel="external">learn more about request methods</a>') %} {% set method_info = _('Change how forms are submited, <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" rel="external">learn more about request methods</a>') %}
{{ preferences_item_header(method_info, method_label, rtl, 'method') }} {{ preferences_item_header(method_info, method_label, rtl, 'method') }}
<select class="form-control" name="method" id="method"> <select class="form-control {{ custom_select_class(rtl) }}" name="method" id="method">
<option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option> <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
<option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option> <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
</select> </select>
@ -86,7 +86,7 @@
{% set safesearch_label = _('SafeSearch') %} {% set safesearch_label = _('SafeSearch') %}
{% set safesearch_info = _('Filter content') %} {% set safesearch_info = _('Filter content') %}
{{ preferences_item_header(safesearch_info, safesearch_label, rtl, 'safesearch') }} {{ preferences_item_header(safesearch_info, safesearch_label, rtl, 'safesearch') }}
<select class="form-control" name="safesearch" id="safesearch"> <select class="form-control {{ custom_select_class(rtl) }}" name="safesearch" id="safesearch">
<option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option> <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
<option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option> <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
<option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option> <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
@ -96,7 +96,7 @@
{% set theme_label = _('Themes') %} {% set theme_label = _('Themes') %}
{% set theme_info = _('Change searx layout') %} {% set theme_info = _('Change searx layout') %}
{{ preferences_item_header(theme_info, theme_label, rtl, 'theme') }} {{ preferences_item_header(theme_info, theme_label, rtl, 'theme') }}
<select class="form-control" name="theme" id="theme"> <select class="form-control {{ custom_select_class(rtl) }}" name="theme" id="theme">
{% for name in themes %} {% for name in themes %}
<option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option> <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
{% endfor %} {% endfor %}
@ -104,7 +104,7 @@
{{ preferences_item_footer(theme_info, theme_label, rtl) }} {{ preferences_item_footer(theme_info, theme_label, rtl) }}
{{ preferences_item_header(_('Choose style for this theme'), _('Style'), rtl, 'oscar_style') }} {{ preferences_item_header(_('Choose style for this theme'), _('Style'), rtl, 'oscar_style') }}
<select class="form-control" name="oscar-style" id="oscar_style"> <select class="form-control {{ custom_select_class(rtl) }}" name="oscar-style" id="oscar_style">
<option value="logicodev" >Logicodev</option> <option value="logicodev" >Logicodev</option>
<option value="pointhi" {% if preferences.get_value('oscar-style') == 'pointhi' %}selected="selected"{% endif %}>Pointhi</option> <option value="pointhi" {% if preferences.get_value('oscar-style') == 'pointhi' %}selected="selected"{% endif %}>Pointhi</option>
<option value="logicodev-dark" {% if preferences.get_value('oscar-style') == 'logicodev-dark' %}selected="selected"{% endif %}>Logicodev dark</option> <option value="logicodev-dark" {% if preferences.get_value('oscar-style') == 'logicodev-dark' %}selected="selected"{% endif %}>Logicodev dark</option>
@ -114,7 +114,7 @@
{% set label = _('Results on new tabs') %} {% set label = _('Results on new tabs') %}
{% set info = _('Open result links on new browser tabs') %} {% set info = _('Open result links on new browser tabs') %}
{{ preferences_item_header(info, label, rtl, 'results_on_new_tab') }} {{ preferences_item_header(info, label, rtl, 'results_on_new_tab') }}
<select class="form-control" name="results_on_new_tab" id="results_on_new_tab"> <select class="form-control {{ custom_select_class(rtl) }}" name="results_on_new_tab" id="results_on_new_tab">
<option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option> <option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option>
<option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option> <option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option>
</select> </select>
@ -123,7 +123,7 @@
{% 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)') %}
{{ preferences_item_header(info, label, rtl, 'doi_resolver') }} {{ preferences_item_header(info, label, rtl, 'doi_resolver') }}
<select class="form-control" name="doi_resolver" id="doi_resolver"> <select class="form-control {{ custom_select_class(rtl) }}" name="doi_resolver" id="doi_resolver">
{% for doi_resolver_name,doi_resolver_url in doi_resolvers.items() %} {% for doi_resolver_name,doi_resolver_url in doi_resolvers.items() %}
<option value="{{ doi_resolver_name }}" {% if doi_resolver_name == current_doi_resolver %}selected="selected"{% endif %}> <option value="{{ doi_resolver_name }}" {% if doi_resolver_name == current_doi_resolver %}selected="selected"{% endif %}>
{{ doi_resolver_name }} - {{ doi_resolver_url }} {{ doi_resolver_name }} - {{ doi_resolver_url }}

View file

@ -1,5 +1,6 @@
{% from 'oscar/macros.html' import custom_select_class %}
<label class="visually-hidden" for="time-range">{{ _('Time range') }}</label> <label class="visually-hidden" for="time-range">{{ _('Time range') }}</label>
<select name="time_range" id="time-range" class="custom-select form-control" accesskey="t">{{- "" -}} <select name="time_range" id="time-range" class="{{ custom_select_class(rtl) }} form-control" accesskey="t">{{- "" -}}
<option id="time-range-anytime" value="" {{ "selected" if time_range=="" or not time_range else ""}}> <option id="time-range-anytime" value="" {{ "selected" if time_range=="" or not time_range else ""}}>
{{- _('Anytime') -}} {{- _('Anytime') -}}
</option>{{- "" -}} </option>{{- "" -}}