From: Christian Heller Date: Sat, 18 May 2024 01:34:44 +0000 (+0200) Subject: Refactor templates. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/decks/condition?a=commitdiff_plain;h=2ca0045683f74254fd0e248c2567fa2efa358c08;p=plomtask Refactor templates. --- diff --git a/templates/_base.html b/templates/_base.html new file mode 100644 index 0000000..0070630 --- /dev/null +++ b/templates/_base.html @@ -0,0 +1,36 @@ + + + + + +processes +conditions +today +calendar +
+{% block content %} +{% endblock %} + + diff --git a/templates/base.html b/templates/base.html deleted file mode 100644 index 0070630..0000000 --- a/templates/base.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - -processes -conditions -today -calendar -
-{% block content %} -{% endblock %} - - 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 %}