From 2149e88bdd64a66d867ad1f5c46e6aa0977d837a Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 2 Jun 2023 15:30:02 +0200 Subject: [mod] template preferences: split into elements (no functional change) HINT: this patch has no functional change / it is the preparation for following changes and bugfixes Over the years, the preferences template became an unmanageable beast. To make the source code more readable the monolith is splitted into elements. The splitting into elements also has the advantage that a new template can make use of them. The reversed checkbox is a quirk that is only used in the prefereces and must be eliminated in the long term. For this the macro 'checkbox_onoff_reversed' was added to the preferences.html template. The 'checkbox' macro is also a quirk of the preferences.html we don't want to use in other templates (it is an input-checkbox in a HTML form that was misused for status display). Signed-off-by: Markus Heiser --- searx/templates/simple/preferences.html | 586 +++++++++++--------------------- 1 file changed, 191 insertions(+), 395 deletions(-) (limited to 'searx/templates/simple/preferences.html') diff --git a/searx/templates/simple/preferences.html b/searx/templates/simple/preferences.html index 3210a36b0..8bc89a118 100644 --- a/searx/templates/simple/preferences.html +++ b/searx/templates/simple/preferences.html @@ -1,7 +1,40 @@ -{% from 'simple/macros.html' import tabs_open, tabs_close, tab_header, tab_footer, checkbox_onoff, checkbox %} -{% from 'simple/icons.html' import icon_big %} +{%- from 'simple/icons.html' import icon_big -%} +{%- extends "simple/page_with_header.html" -%} -{% extends "simple/page_with_header.html" %} +{%- macro tabs_open() -%} +
+{%- endmacro -%} + +{%- macro tab_header(name, id, label, checked) -%} + + +
+{%- endmacro -%} + +{%- macro tab_footer() -%} +
+{%- endmacro -%} + +{%- macro tabs_close() -%} +
+{%- endmacro -%} + +{%- macro checkbox(name, checked, disabled) -%} + {%- if checked == '?' -%} + {{- icon_small('warning') -}} + {%- else -%} + + {%- endif -%} +{%- endmacro -%} + +{%- macro checkbox_onoff_reversed(name, checked) -%} + +{%- endmacro -%} {%- macro plugin_preferences(section) -%} {%- for plugin in plugins -%} @@ -9,7 +42,7 @@
{{- '' -}} {{ _(plugin.name) }}{{- '' -}}
- {{- checkbox_onoff('plugin_' + plugin.id, plugin.id not in allowed_plugins) -}} + {{- checkbox_onoff_reversed('plugin_' + plugin.id, plugin.id not in allowed_plugins) -}}
{{- '' -}}
{{- _(plugin.description) -}} @@ -19,427 +52,190 @@ {%- endfor -%} {%- endmacro -%} -{% macro engine_about(search_engine) -%} -{% if search_engine.about is defined %} -{% set about = search_engine.about %} - {%- endif -%} -{%- endmacro %} +{%- endmacro -%} {%- macro engine_time(engine_name) -%} -{{- "" -}} + {{- '' -}} {%- if stats[engine_name].time != None -%} - {{- stats[engine_name].time -}}{{- "" -}} + {{- stats[engine_name].time -}}{{- '' -}} {{- "" -}} -