searxng/searx/templates/simple/categories.html
Markus Heiser 189dd0155d [web-client] simple theme: refactor jinja_svg_catalog and cleanup icon names
This patch implements the template generation of the template:

  searx/templates/simple/icons.html

by the way the icon set (the icon names) has been normalized:

  film-outline   --> film
  magnet-outline --> magnet
  ..
  warning        --> alert

Some missing (categorie) icons had been added.

Some of the ionicons are not suitable for a dark theme, we fixed the svg
manually in src/svg/ionicons:

- https://github.com/searxng/searxng/pull/4284#issuecomment-2680550342

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-02-28 12:27:41 +01:00

42 lines
2 KiB
HTML

{% from 'simple/icons.html' import icon_big %}
{%- set category_icons = {
'apps': 'appstore',
'dictionaries': 'book',
'files': 'file-tray-full',
'general': 'search',
'images': 'image',
'it': 'layers',
'map': 'location',
'music': 'musical-notes',
'news': 'newspaper',
'radio': 'radio',
'science': 'school',
'social media': 'people',
'TV': 'tv',
'videos': 'play',
} -%}
<div id="categories" class="search_categories">{{- '' -}}
<div id="categories_container">
{%- if not search_on_category_select or not display_tooltip -%}
{%- for category in categories -%}
<div class="category category_checkbox">{{- '' -}}
<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') -}}
<div class="category_name">{{- _(category) -}}</div>
</label>
</div>
{%- endfor -%}
{%- if display_tooltip %}<div class="help">{{ _('Click on the magnifier to perform search') }}</div>{% endif -%}
{%- else -%}
{%- for category in categories -%}{{- '\n' -}}
<button type="submit" name="category_{{ category }}" class="category category_button {% if category in selected_categories %}selected{% endif %}">
{{- icon_big(category_icons[category]) if category in category_icons else icon_big('globe') -}}
<div class="category_name">{{- _(category) -}}</div>{{- '' -}}
</button>{{- '' -}}
{%- endfor -%}
<input name="categories" id="selected-categories" type="hidden" />
{{- '\n' -}}
{%- endif -%}
</div>{{- '' -}}
</div>