Merge pull request #1059 from kvch/preferences-support-intuitive

preferences: make supported/not supported labels
This commit is contained in:
Adam Tauber 2017-10-07 19:14:16 +02:00 committed by GitHub
commit 1adc8d6e26
9 changed files with 39 additions and 14 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -19,3 +19,5 @@
@import "cursor.less"; @import "cursor.less";
@import "code.less"; @import "code.less";
@import "preferences.less";

View File

@ -0,0 +1,3 @@
.table > tbody > tr > td, .table > tbody > tr > th {
vertical-align: middle !important;
}

View File

@ -17,3 +17,5 @@
@import "code.less"; @import "code.less";
@import "navbar.less"; @import "navbar.less";
@import "preferences.less";

View File

@ -0,0 +1,3 @@
.table > tbody > tr > td, .table > tbody > tr > th {
vertical-align: middle !important;
}

View File

@ -85,3 +85,15 @@
</label> </label>
</div> </div>
{%- endmacro %} {%- 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 %}

View File

@ -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" %} {% extends "oscar/base.html" %}
{% block title %}{{ _('preferences') }} - {% endblock %} {% block title %}{{ _('preferences') }} - {% endblock %}
{% block content %} {% block content %}
<div> <div>
<h1>{{ _('Preferences') }}</h1> <h1>{{ _('Preferences') }}</h1>
@ -148,7 +149,7 @@
<th>{{ _("Allow") }}</th> <th>{{ _("Allow") }}</th>
<th>{{ _("Engine name") }}</th> <th>{{ _("Engine name") }}</th>
<th>{{ _("Shortcut") }}</th> <th>{{ _("Shortcut") }}</th>
<th>{{ _("Supports selected language") }}</th> <th>{{ _("Selected language") }}</th>
<th>{{ _("SafeSearch") }}</th> <th>{{ _("SafeSearch") }}</th>
<th>{{ _("Time range") }}</th> <th>{{ _("Time range") }}</th>
<th>{{ _("Avg. time") }}</th> <th>{{ _("Avg. time") }}</th>
@ -156,8 +157,9 @@
{% else %} {% else %}
<th>{{ _("Max time") }}</th> <th>{{ _("Max time") }}</th>
<th>{{ _("Avg. time") }}</th> <th>{{ _("Avg. time") }}</th>
<th>{{ _("Time range") }}</th>
<th>{{ _("SafeSearch") }}</th> <th>{{ _("SafeSearch") }}</th>
<th>{{ _("Supports selected language") }}</th> <th>{{ _("Selected language") }}</th>
<th>{{ _("Shortcut") }}</th> <th>{{ _("Shortcut") }}</th>
<th>{{ _("Engine name") }}</th> <th>{{ _("Engine name") }}</th>
<th>{{ _("Allow") }}</th> <th>{{ _("Allow") }}</th>
@ -172,16 +174,17 @@
</td> </td>
<th>{{ search_engine.name }}</th> <th>{{ search_engine.name }}</th>
<td class="name">{{ shortcuts[search_engine.name] }}</td> <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>{{ 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><input type="checkbox" {{ "checked" if search_engine.safesearch==True else ""}} readonly="readonly" disabled="disabled"></td> <td>{{ support_toggle(search_engine.safesearch==True) }}</td>
<td><input type="checkbox" {{ "checked" if search_engine.time_range_support==True else ""}} readonly="readonly" disabled="disabled"></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_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> <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
{% else %} {% 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_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 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>{{ support_toggle(search_engine.time_range_support==True) }}</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>{{ 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> <td>{{ shortcuts[search_engine.name] }}</td>
<th>{{ search_engine.name }}</th> <th>{{ search_engine.name }}</th>
<td class="onoff-checkbox"> <td class="onoff-checkbox">