From 2ca0045683f74254fd0e248c2567fa2efa358c08 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 18 May 2024 03:34:44 +0200 Subject: [PATCH] Refactor templates. --- templates/{base.html => _base.html} | 0 templates/calendar.html | 4 +- templates/condition.html | 8 ++-- templates/conditions.html | 2 +- templates/day.html | 21 +++------ templates/msg.html | 4 +- templates/process.html | 70 ++++------------------------- templates/processes.html | 2 +- templates/todo.html | 68 ++++------------------------ 9 files changed, 35 insertions(+), 144 deletions(-) rename templates/{base.html => _base.html} (100%) diff --git a/templates/base.html b/templates/_base.html similarity index 100% rename from templates/base.html rename to templates/_base.html diff --git a/templates/calendar.html b/templates/calendar.html index eae103d..f6208bb 100644 --- a/templates/calendar.html +++ b/templates/calendar.html @@ -1,4 +1,6 @@ -{% extends 'base.html' %} +{% extends '_base.html' %} + + {% block css %} tr.week_row td { diff --git a/templates/condition.html b/templates/condition.html index 00aeedb..8e73e5e 100644 --- a/templates/condition.html +++ b/templates/condition.html @@ -1,4 +1,5 @@ -{% extends 'base.html' %} +{% extends '_base.html' %} +{% import '_macros.html' as macros %} @@ -23,9 +24,6 @@ - -
- -
+{{ macros.edit_buttons() }} {% endblock %} diff --git a/templates/conditions.html b/templates/conditions.html index a717bf0..e2c4ec1 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends '_base.html' %} {% block content %} add diff --git a/templates/day.html b/templates/day.html index a0823f3..da5e17a 100644 --- a/templates/day.html +++ b/templates/day.html @@ -1,4 +1,5 @@ -{% extends 'base.html' %} +{% extends '_base.html' %} +{% import '_macros.html' as macros %} @@ -106,11 +107,6 @@ td.todo_line { comment:
add todo: - -{% for process in processes %} - -{% endfor %} -

todo

@@ -148,13 +144,9 @@ add todo: {% endif %} {% endfor %} - - - -{% for process in enablers_for[condition.id_] %} - -{% endfor %} - +{% set list_name = "todos_for_%s"|format(condition.id_) %} + +{{ macros.datalist_of_direct_titles(list_name, enablers_for[condition.id_]) }} {% endfor %} @@ -184,5 +176,6 @@ add todo: -{% endblock %} +{{ macros.datalist_of_direct_titles("processes", processes) }} +{% endblock %} diff --git a/templates/msg.html b/templates/msg.html index 90cd61c..3672f21 100644 --- a/templates/msg.html +++ b/templates/msg.html @@ -1,4 +1,6 @@ -{% extends 'base.html' %} +{% extends '_base.html' %} + + {% block content %}

{{msg}}

diff --git a/templates/process.html b/templates/process.html index 10442cf..41f8117 100644 --- a/templates/process.html +++ b/templates/process.html @@ -1,4 +1,5 @@ -{% extends 'base.html' %} +{% extends '_base.html' %} +{% import '_macros.html' as macros %} @@ -56,59 +57,17 @@ add: conditions - - -{% for condition in process.conditions %} - - - - -{% endfor %} -
- - -{{condition.title.newest|e}} -
-add: - +{{ macros.simple_checkbox_table("condition", process.conditions, "condition", "condition_candidates") }} enables - - -{% for condition in process.enables %} - - - - -{% endfor %} -
- - -{{condition.title.newest|e}} -
-add: - +{{ macros.simple_checkbox_table("enables", process.enables, "condition", "condition_candidates") }} disables - - -{% for condition in process.disables %} - - - - -{% endfor %} -
- - -{{condition.title.newest|e}} -
-add: - +{{ macros.simple_checkbox_table("disables", process.disables, "condition", "condition_candidates") }} @@ -133,20 +92,9 @@ add: - -{% for condition_candidate in condition_candidates %} - -{% endfor %} - - -{% for candidate in step_candidates %} - -{% endfor %} - - - -
- -
+{{ macros.edit_buttons() }} + +{{ macros.datalist_of_direct_titles("condition_candidates", condition_candidates) }} +{{ macros.datalist_of_direct_titles("step_candidates", step_candidates) }} {% endblock %} diff --git a/templates/processes.html b/templates/processes.html index 6dc3e85..6c3c64b 100644 --- a/templates/processes.html +++ b/templates/processes.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends '_base.html' %} {% block content %} add diff --git a/templates/todo.html b/templates/todo.html index 44cdfa7..d3957af 100644 --- a/templates/todo.html +++ b/templates/todo.html @@ -1,4 +1,5 @@ -{% extends 'base.html' %} +{% extends '_base.html' %} +{% import '_macros.html' as macros %} @@ -29,59 +30,17 @@ conditions - - -{% for condition in todo.conditions %} - - - - -{% endfor %} -
- - -{{condition.title.newest|e}} -
-add: - +{{ macros.simple_checkbox_table("condition", todo.conditions, "condition", "condition_candidates") }} enables - - -{% for condition in todo.enables %} - - - - -{% endfor %} -
- - -{{condition.title.newest|e}} -
-add: - +{{ macros.simple_checkbox_table("enables", todo.enables, "condition", "condition_candidates") }} disables - - -{% for condition in todo.disables%} - - - - -{% endfor %} -
- - -{{condition.title.newest|e}} -
-add: - +{{ macros.simple_checkbox_table("disables", todo.disables, "condition", "condition_candidates") }} @@ -109,20 +68,9 @@ adopt: - -
- -
+{{ macros.edit_buttons() }} - -{% for condition_candidate in condition_candidates %} - -{% endfor %} - - -{% for candidate in todo_candidates %} - -{% endfor %} - +{{ macros.datalist_of_direct_titles("condition_candidates", condition_candidates) }} +{{ macros.datalist_of_indirect_titles("todo_candidates", todo_candidates) }} {% endblock %} -- 2.30.2