searxng/searx/templates/simple/categories.html
Markus Heiser 7d17d37ac7 [fix] don't show a category if there is no active engine in
When deactivate all the engines of a category, this category should disappeare.
This feature has been lost in commit 8e9ad1cc.

For better readability, webapp.get_enabled_categories() has been rewritten with
identical functionality.

Related:

- https://github.com/searxng/searxng/issues/1020
- https://github.com/searxng/searxng/issues/1604

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-04-10 09:22:21 +02:00

27 lines
1.2 KiB
HTML

{% from 'simple/icons.html' import icon_big %}
{%- set category_icons = {
'general': 'search-outline',
'images': 'image-outline',
'videos': 'play-outline',
'news': 'newspaper-outline',
'map': 'location-outline',
'music': 'musical-notes-outline',
'it': 'layers-outline',
'science': 'school-outline',
'files': 'file-tray-full-outline',
'social media': 'people-outline',
} -%}
<div id="categories" class="search_categories">{{- '' -}}
<div id="categories_container">
{%- for category in categories -%}
<div class="category"><input type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}"{% if category in selected_categories %} checked="checked"{% endif %}/>
<label for="checkbox_{{ category|replace(' ', '_') }}" class="tooltips">
{{- icon_big(category_icons[category]) if category in category_icons else icon_big('globe-outline') -}}
<div class="category_name">{{- _(category) -}}</div>
</label>
</div>
{%- endfor -%}
{%- if display_tooltip %}<div class="help">{{ _('Click on the magnifier to perform search') }}</div>{% endif -%}
</div>{{- '' -}}
</div>