diff options
author | Noémi Ványi <sitbackandwait@gmail.com> | 2017-10-06 21:50:59 +0200 |
---|---|---|
committer | Noémi Ványi <sitbackandwait@gmail.com> | 2017-10-06 22:08:24 +0200 |
commit | 47ee15f5cee81ac1c68c07592349caecd2bf137a (patch) | |
tree | 28f7415cab331a4ec1dcc9710b221b358e4be2cf /searx/templates | |
parent | 1dffbd33907103434bdc13ff035b8993559b5158 (diff) | |
download | searxng-47ee15f5cee81ac1c68c07592349caecd2bf137a.tar.gz searxng-47ee15f5cee81ac1c68c07592349caecd2bf137a.zip |
preferences: make supported/not supported labels
Also, Time range support display was missing from RTL locales.
Now it is fixed.
Closes #558
Diffstat (limited to 'searx/templates')
-rw-r--r-- | searx/templates/oscar/macros.html | 12 | ||||
-rw-r--r-- | searx/templates/oscar/preferences.html | 31 |
2 files changed, 29 insertions, 14 deletions
diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html index c35a19158..6235bcc62 100644 --- a/searx/templates/oscar/macros.html +++ b/searx/templates/oscar/macros.html @@ -85,3 +85,15 @@ </label> </div> {%- endmacro %} + +{% macro support_toggle(supports) -%} + {% if supports %} + <span class="label label-success"> + {{ _("supported") }} + </span> + {% else %} + <span class="label label-danger"> + {{ _("not supported") }} + </span> + {% endif %} +{%- endmacro %} diff --git a/searx/templates/oscar/preferences.html b/searx/templates/oscar/preferences.html index afb389e44..64706b06b 100644 --- a/searx/templates/oscar/preferences.html +++ b/searx/templates/oscar/preferences.html @@ -1,7 +1,8 @@ -{% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl, checkbox_toggle %} +{% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl, checkbox_toggle, support_toggle %} {% extends "oscar/base.html" %} {% block title %}{{ _('preferences') }} - {% endblock %} {% block content %} + <div> <h1>{{ _('Preferences') }}</h1> @@ -148,7 +149,7 @@ <th>{{ _("Allow") }}</th> <th>{{ _("Engine name") }}</th> <th>{{ _("Shortcut") }}</th> - <th>{{ _("Supports selected language") }}</th> + <th>{{ _("Selected language") }}</th> <th>{{ _("SafeSearch") }}</th> <th>{{ _("Time range") }}</th> <th>{{ _("Avg. time") }}</th> @@ -156,8 +157,9 @@ {% else %} <th>{{ _("Max time") }}</th> <th>{{ _("Avg. time") }}</th> + <th>{{ _("Time range") }}</th> <th>{{ _("SafeSearch") }}</th> - <th>{{ _("Supports selected language") }}</th> + <th>{{ _("Selected language") }}</th> <th>{{ _("Shortcut") }}</th> <th>{{ _("Engine name") }}</th> <th>{{ _("Allow") }}</th> @@ -172,17 +174,18 @@ </td> <th>{{ search_engine.name }}</th> <td class="name">{{ shortcuts[search_engine.name] }}</td> - <td><input type="checkbox" {{ "checked" if current_language == 'all' or current_language in search_engine.supported_languages or current_language.split('-')[0] in search_engine.supported_languages else ""}} readonly="readonly" disabled="disabled"></td> - <td><input type="checkbox" {{ "checked" if search_engine.safesearch==True else ""}} readonly="readonly" disabled="disabled"></td> - <td><input type="checkbox" {{ "checked" if search_engine.time_range_support==True else ""}} readonly="readonly" disabled="disabled"></td> - <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td> - <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td> - {% else %} - <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td> - <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td> - <td><input type="checkbox" {{ "checked" if search_engine.safesearch==True else ""}} readonly="readonly" disabled="disabled"></td> - <td><input type="checkbox" {{ "checked" if current_language == 'all' or current_language in search_engine.supported_languages or current_language.split('-')[0] in search_engine.supported_languages else ""}} readonly="readonly" disabled="disabled"></td> - <td>{{ shortcuts[search_engine.name] }}</td> + <td>{{ support_toggle(current_language == 'all' or current_language in search_engine.supported_languages or current_language.split('-')[0] in search_engine.supported_languages) }}</td> + <td>{{ support_toggle(search_engine.safesearch==True) }}</td> + <td>{{ support_toggle(search_engine.time_range_support==True) }}</td> + <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td> + <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td> + {% else %} + <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td> + <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td> + <td>{{ support_toggle(search_engine.time_range_support==True) }}</td> + <td>{{ support_toggle(search_engine.safesearch==True) }}</td> + <td>{{ support_toggle(current_language == 'all' or current_language in search_engine.supported_languages or current_language.split('-')[0] in search_engine.supported_languages) }}</td> + <td>{{ shortcuts[search_engine.name] }}</td> <th>{{ search_engine.name }}</th> <td class="onoff-checkbox"> {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }} |