diff options
author | Martin Fischer <martin@push-f.com> | 2021-12-22 15:51:26 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2022-01-03 07:01:49 +0100 |
commit | 8e9ad1ccc296c220d61f12926c94d98baa83e3ca (patch) | |
tree | 5ba40ba51b65c5fae48c4b008ebe85d0563b7466 /searx/webapp.py | |
parent | 02e9bdf7550b5f5545bd842b24b71680960dd7a7 (diff) | |
download | searxng-8e9ad1ccc296c220d61f12926c94d98baa83e3ca.tar.gz searxng-8e9ad1ccc296c220d61f12926c94d98baa83e3ca.zip |
[enh] introduce categories_as_tabs
Previously all categories were displayed as search engine tabs.
This commit changes that so that only the categories listed under
categories_as_tabs in settings.yml are displayed.
This lets us introduce more categories without cluttering up the UI.
Categories not displayed as tabs can still be searched with !bangs.
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-x | searx/webapp.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index a2aa84d9d..f884c35ef 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -390,12 +390,6 @@ def get_translations(): } -def _get_ordered_categories(): - ordered_categories = list(settings['ui']['categories_order']) - ordered_categories.extend(x for x in sorted(categories.keys()) if x not in ordered_categories) - return ordered_categories - - def _get_enable_categories(all_categories): disabled_engines = request.preferences.engines.get_disabled() enabled_categories = set( @@ -430,8 +424,8 @@ def render(template_name, override_theme=None, **kwargs): kwargs['query_in_title'] = request.preferences.get_value('query_in_title') kwargs['safesearch'] = str(request.preferences.get_value('safesearch')) kwargs['theme'] = get_current_theme_name(override=override_theme) - kwargs['all_categories'] = _get_ordered_categories() - kwargs['categories'] = _get_enable_categories(kwargs['all_categories']) + kwargs['categories_as_tabs'] = settings['categories_as_tabs'] + kwargs['categories'] = _get_enable_categories(categories.keys()) # i18n kwargs['language_codes'] = [l for l in languages if l[0] in settings['search']['languages']] |