summaryrefslogtreecommitdiff
path: root/searx/templates/simple
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2023-09-09 16:49:14 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2023-09-18 21:29:11 +0200
commita55e0ac553e608e5657573a8173aa5a040a49054 (patch)
treed3d7dbdd8648e1f5007756628c2bc7cbfb19d774 /searx/templates/simple
parent90b0bfd1bf30ecd6b6e8b54d300be5fba45aecca (diff)
downloadsearxng-a55e0ac553e608e5657573a8173aa5a040a49054.tar.gz
searxng-a55e0ac553e608e5657573a8173aa5a040a49054.zip
[feat] search on category select without JS
Co-authored-by: Alexandre Flament <alex@al-f.net>
Diffstat (limited to 'searx/templates/simple')
-rw-r--r--searx/templates/simple/categories.html29
-rw-r--r--searx/templates/simple/preferences.html3
-rw-r--r--searx/templates/simple/preferences/search_on_category_select.html16
3 files changed, 39 insertions, 9 deletions
diff --git a/searx/templates/simple/categories.html b/searx/templates/simple/categories.html
index 29616f127..6ba550015 100644
--- a/searx/templates/simple/categories.html
+++ b/searx/templates/simple/categories.html
@@ -13,14 +13,25 @@
} -%}
<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 -%}
+ {%- if not search_on_category_select or not display_tooltip -%}
+ {%- for category in categories_as_tabs -%}
+ <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-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 -%}
+ {%- else -%}
+ {%- for category in categories_as_tabs -%}{{- '\n' -}}
+ <button type="submit" name="category_{{ category|replace(' ', '_') }}" 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-outline') -}}
+ <div class="category_name">{{- _(category) -}}</div>{{- '' -}}
+ </button>{{- '' -}}
+ {%- endfor -%}
+ {{- '\n' -}}
+ {%- endif -%}
</div>{{- '' -}}
</div>
diff --git a/searx/templates/simple/preferences.html b/searx/templates/simple/preferences.html
index 22979ab05..3d62682bb 100644
--- a/searx/templates/simple/preferences.html
+++ b/searx/templates/simple/preferences.html
@@ -197,6 +197,9 @@
{%- if 'infinite_scroll' not in locked_preferences -%}
{%- include 'simple/preferences/infinite_scroll.html' -%}
{%- endif -%}
+ {%- if 'search_on_category_select' not in locked_preferences -%}
+ {%- include 'simple/preferences/search_on_category_select.html' -%}
+ {%- endif -%}
{{- plugin_preferences('ui') -}}
{{- tab_footer() -}}
diff --git a/searx/templates/simple/preferences/search_on_category_select.html b/searx/templates/simple/preferences/search_on_category_select.html
new file mode 100644
index 000000000..2bc680a61
--- /dev/null
+++ b/searx/templates/simple/preferences/search_on_category_select.html
@@ -0,0 +1,16 @@
+<fieldset>{{- '' -}}
+ <legend>{{ _('Search on category select') }}</legend>{{- '' -}}
+ <p class="value">{{- '' -}}
+ <input type="checkbox" {{- ' ' -}}
+ name="search_on_category_select" {{- ' ' -}}
+ aria-labelledby="pref_search_on_category_select" {{- ' ' -}}
+ class="checkbox-onoff" {{- ' ' -}}
+ {%- if preferences.get_value('search_on_category_select') -%}
+ checked
+ {%- endif -%}{{- ' ' -}}
+ />{{- '' -}}
+ </p>{{- '' -}}
+ <div class="description">
+ {{- _('Perform search immediately if a category selected. Disable to select multiple categories') -}}
+ </div>{{- '' -}}
+</fieldset>{{- '' -}} \ No newline at end of file