From 52b9cba93caae2745f1d467cac7dd59f019110b5 Mon Sep 17 00:00:00 2001 From: Kaibu Date: Tue, 19 Nov 2019 19:57:33 +0100 Subject: [PATCH] tabulator editor --- .../templates/forms/edit_internal_recipe.html | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/cookbook/templates/forms/edit_internal_recipe.html b/cookbook/templates/forms/edit_internal_recipe.html index 8bb031048..4c3dc55a6 100644 --- a/cookbook/templates/forms/edit_internal_recipe.html +++ b/cookbook/templates/forms/edit_internal_recipe.html @@ -21,7 +21,13 @@ {% csrf_token %} {{ form|crispy }}
+
+
+ +
+ +
{% trans 'Delete' %} @@ -48,8 +54,7 @@ title: "{% trans 'ingredient' %}", field: "ingredient", validator: "required", - editor: "select", - editorParams: {values: {"test1": "Test1", "test2": "Test2"}} + editor: "input" }, {title: "{% trans 'amount' %}", field: "amount", validator: "required", editor: "input"}, {title: "{% trans 'unit' %}", field: "unit", validator: "required", editor: "input"}, @@ -72,6 +77,18 @@ }) } }); + + + document.getElementById("new_empty").addEventListener("click", function () { + data.push({ + ingredient: "{% trans 'ingredient' %}", + amount: "100", + unit: "g", + id: Math.floor(Math.random() * 10000000), + delete: false, + }); + }); }); + {% endblock %} \ No newline at end of file