From cf11e4d71878588dfc2bb1b1090b35f99010a780 Mon Sep 17 00:00:00 2001 From: Gregoo Date: Wed, 29 Jan 2025 15:12:10 +0100 Subject: [PATCH] Move the dynamic input into a macro --- templates/macro/form.html | 15 +++++++++++++++ templates/part/table.html | 11 ++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/templates/macro/form.html b/templates/macro/form.html index f9c5a5d..cd126e9 100644 --- a/templates/macro/form.html +++ b/templates/macro/form.html @@ -15,3 +15,18 @@ {{ text }} {% endif %} {% endmacro %} + +{% macro input(id, html_id, url, value) %} + + {% if g.login.is_authenticated() %} + + {% else %} + + {% endif %} +{% endmacro %} diff --git a/templates/part/table.html b/templates/part/table.html index 8e1da01..b7139ed 100644 --- a/templates/part/table.html +++ b/templates/part/table.html @@ -1,3 +1,4 @@ +{% import 'macro/form.html' as form %} {% import 'macro/table.html' as table %}
@@ -32,15 +33,7 @@ {{ item.fields.total_missing }} {% else %}
- {% if g.login.is_authenticated() %} - - - {% else %} - - - {% endif %} + {{ form.input(item.fields.id, item.html_id(), item.url_for_missing(), item.fields.total_missing) }}
{% endif %}