mirror of
https://github.com/searxng/searxng.git
synced 2025-12-28 22:50:01 +00:00
[enh] change categories_as_tabs from a list to a dict
The tab icon names are currently hard coded in the templates.
This commit lets us introduce an icon property in the future, e.g:
categories_as_tabs:
general:
icon: search-outline
This commit is contained in:
@@ -146,7 +146,9 @@ def group_engines_in_tab(engines: Iterable[Engine]) -> List[Tuple[str, Iterable[
|
||||
"""Groups an Iterable of engines by their first non tab category"""
|
||||
|
||||
def get_group(eng):
|
||||
non_tab_categories = [c for c in eng.categories if c not in settings['categories_as_tabs'] + [OTHER_CATEGORY]]
|
||||
non_tab_categories = [
|
||||
c for c in eng.categories if c not in list(settings['categories_as_tabs'].keys()) + [OTHER_CATEGORY]
|
||||
]
|
||||
return non_tab_categories[0] if len(non_tab_categories) > 0 else DEFAULT_GROUP_NAME
|
||||
|
||||
groups = itertools.groupby(sorted(engines, key=get_group), get_group)
|
||||
|
||||
Reference in New Issue
Block a user