Real fix for preferences in RTL *and* in LTR

This commit is contained in:
Cqoicebordel 2015-02-11 20:53:06 +01:00
parent 3d5a4b091d
commit f4bdcc067f
2 changed files with 22 additions and 22 deletions

View File

@ -36,26 +36,26 @@
<p class="text-muted">{{ result.pretty_url }}</p>
{%- endmacro %}
{% macro preferences_item_header(info, label) -%}
{% macro preferences_item_header(info, label, rtl) -%}
{% if rtl %}
<div class="row form-group">
<label class="col-sm-3 col-md-2">{{ label }}</label>
<span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
<div class="col-sm-4 col-md-4">
{% else %}
<div class="row form-group">
<span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
<label class="col-sm-3 col-md-2">{{ label }}</label>
<div class="col-sm-4 col-md-4">
{% endif %}
{%- endmacro %}
{% macro preferences_item_footer(info, label) -%}
{% macro preferences_item_footer(info, label, rtl) -%}
{% if rtl %}
</div>
<span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
</div>
{% else %}
</div>
<label class="col-sm-3 col-md-2">{{ label }}</label>
</div>
{% else %}
</div>
<span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
</div>
{% endif %}
{%- endmacro %}

View File

@ -41,73 +41,73 @@
</div>
{% set language_label = _('Search language') %}
{% set language_info = _('What language do you prefer for search?') %}
{{ preferences_item_header(language_info, language_label) }}
{{ preferences_item_header(language_info, language_label, rtl) }}
<select class="form-control" name='language'>
<option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
{% for lang_id,lang_name,country_name in language_codes %}
<option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
{% endfor %}
</select>
{{ preferences_item_footer(language_info, language_label) }}
{{ preferences_item_footer(language_info, language_label, rtl) }}
{% set locale_label = _('Interface language') %}
{% set locale_info = _('Change the language of the layout') %}
{{ preferences_item_header(locale_info, locale_label) }}
{{ preferences_item_header(locale_info, locale_label, rtl) }}
<select class="form-control" name='locale'>
{% for locale_id,locale_name in locales.items() %}
<option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
{% endfor %}
</select>
{{ preferences_item_footer(locale_info, locale_label) }}
{{ preferences_item_footer(locale_info, locale_label, rtl) }}
{% set autocomplete_label = _('Autocomplete') %}
{% set autocomplete_info = _('Find stuff as you type') %}
{{ preferences_item_header(autocomplete_info, autocomplete_label) }}
{{ preferences_item_header(autocomplete_info, autocomplete_label, rtl) }}
<select class="form-control" name="autocomplete">
<option value=""> - </option>
{% for backend in autocomplete_backends %}
<option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
{% endfor %}
</select>
{{ preferences_item_footer(autocomplete_info, autocomplete_label) }}
{{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }}
{% set image_proxy_label = _('Image proxy') %}
{% set image_proxy_info = _('Proxying image results through searx') %}
{{ preferences_item_header(image_proxy_info, image_proxy_label) }}
{{ preferences_item_header(image_proxy_info, image_proxy_label, rtl) }}
<select class="form-control" 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>
{{ preferences_item_footer(image_proxy_info, image_proxy_label) }}
{{ preferences_item_footer(image_proxy_info, image_proxy_label, rtl) }}
{% 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>') %}
{{ preferences_item_header(method_info, method_label) }}
{{ preferences_item_header(method_info, method_label, rtl) }}
<select class="form-control" 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>
{{ preferences_item_footer(method_info, method_label) }}
{{ preferences_item_footer(method_info, method_label, rtl) }}
{% set safesearch_label = _('SafeSearch') %}
{% set safesearch_info = _('Filter content') %}
{{ preferences_item_header(safesearch_info, safesearch_label) }}
{{ preferences_item_header(safesearch_info, safesearch_label, rtl) }}
<select class="form-control" 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>
{{ preferences_item_footer(safesearch_info, safesearch_label) }}
{{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }}
{% set theme_label = _('Themes') %}
{% set theme_info = _('Change searx layout') %}
{{ preferences_item_header(theme_info, theme_label) }}
{{ preferences_item_header(theme_info, theme_label, rtl) }}
<select class="form-control" name="theme">
{% for name in themes %}
<option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
{% endfor %}
</select>
{{ preferences_item_footer(theme_info, theme_label) }}
{{ preferences_item_footer(theme_info, theme_label, rtl) }}
</div>
</fieldset>
</div>