mirror of https://github.com/searxng/searxng.git
[enh] group engines in preference tabs
This commit is contained in:
parent
b02f762687
commit
31e206361f
|
@ -348,7 +348,11 @@
|
||||||
<th scope="col" class="text-right">{{ _("Allow") }}</th>
|
<th scope="col" class="text-right">{{ _("Allow") }}</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% for search_engine in engines_by_category[categ] %}
|
{% for group, engines in engines_by_category[categ] | group_engines_in_tab %}
|
||||||
|
{% if loop.length > 1 %}
|
||||||
|
<tr><th colspan="9">{{_(group)}}</th></tr>
|
||||||
|
{% endif %}
|
||||||
|
{% for search_engine in engines %}
|
||||||
{% if not search_engine.private %}
|
{% if not search_engine.private %}
|
||||||
<tr>
|
<tr>
|
||||||
{% if not rtl %}
|
{% if not rtl %}
|
||||||
|
@ -382,6 +386,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -289,7 +289,11 @@
|
||||||
<th>{{ _("Max time") }}</th>
|
<th>{{ _("Max time") }}</th>
|
||||||
<th>{{ _("Reliability") }}</th>
|
<th>{{ _("Reliability") }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for search_engine in engines_by_category[categ] %}
|
{% for group, engines in engines_by_category[categ] | group_engines_in_tab %}
|
||||||
|
{% if loop.length > 1 %}
|
||||||
|
<tr><th colspan="9">{{_(group)}}</th></tr>
|
||||||
|
{% endif %}
|
||||||
|
{% for search_engine in engines %}
|
||||||
{% if not search_engine.private %}
|
{% if not search_engine.private %}
|
||||||
{% set engine_id = 'engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_') %}
|
{% set engine_id = 'engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_') %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -305,6 +309,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{{ tab_footer() }}
|
{{ tab_footer() }}
|
||||||
|
|
|
@ -59,9 +59,11 @@ from searx.settings_defaults import OUTPUT_FORMATS
|
||||||
from searx.settings_loader import get_default_settings_path
|
from searx.settings_loader import get_default_settings_path
|
||||||
from searx.exceptions import SearxParameterException
|
from searx.exceptions import SearxParameterException
|
||||||
from searx.engines import (
|
from searx.engines import (
|
||||||
|
DEFAULT_GROUP_NAME,
|
||||||
categories,
|
categories,
|
||||||
engines,
|
engines,
|
||||||
engine_shortcuts,
|
engine_shortcuts,
|
||||||
|
group_engines_in_tab,
|
||||||
)
|
)
|
||||||
from searx.webutils import (
|
from searx.webutils import (
|
||||||
UnicodeWriter,
|
UnicodeWriter,
|
||||||
|
@ -152,6 +154,7 @@ app = Flask(__name__, static_folder=settings['ui']['static_path'], template_fold
|
||||||
app.jinja_env.trim_blocks = True
|
app.jinja_env.trim_blocks = True
|
||||||
app.jinja_env.lstrip_blocks = True
|
app.jinja_env.lstrip_blocks = True
|
||||||
app.jinja_env.add_extension('jinja2.ext.loopcontrols') # pylint: disable=no-member
|
app.jinja_env.add_extension('jinja2.ext.loopcontrols') # pylint: disable=no-member
|
||||||
|
app.jinja_env.filters['group_engines_in_tab'] = group_engines_in_tab # pylint: disable=no-member
|
||||||
app.secret_key = settings['server']['secret_key']
|
app.secret_key = settings['server']['secret_key']
|
||||||
|
|
||||||
babel = Babel(app)
|
babel = Babel(app)
|
||||||
|
@ -169,6 +172,16 @@ _category_names = (
|
||||||
gettext('map'),
|
gettext('map'),
|
||||||
gettext('onions'),
|
gettext('onions'),
|
||||||
gettext('science'),
|
gettext('science'),
|
||||||
|
# non-tab categories
|
||||||
|
gettext('apps'),
|
||||||
|
gettext('dictionaries'),
|
||||||
|
gettext('lyrics'),
|
||||||
|
gettext('packages'),
|
||||||
|
gettext('q&a'),
|
||||||
|
gettext('repos'),
|
||||||
|
gettext('software wikis'),
|
||||||
|
gettext('web'),
|
||||||
|
gettext(DEFAULT_GROUP_NAME),
|
||||||
)
|
)
|
||||||
|
|
||||||
_simple_style = (gettext('auto'), gettext('light'), gettext('dark'))
|
_simple_style = (gettext('auto'), gettext('light'), gettext('dark'))
|
||||||
|
|
Loading…
Reference in New Issue