From d9dd45cb8980acf7a5cfe2555e260cb1708ea1df Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 6 Apr 2015 15:19:22 -0400 Subject: Use disabled template for mappings and lists This way lists and mappings can be empty and still allow cloning of the last row whic his always disabled and hidden. The javascript now clones the last row then fixes the indexes in the new cloned row, and re-enables and un-hides the previous last which becomes a new empty row. Signed-off-by: Simo Sorce --- templates/admin/plugin_config.html | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/templates/admin/plugin_config.html b/templates/admin/plugin_config.html index 79f6319..5072fca 100644 --- a/templates/admin/plugin_config.html +++ b/templates/admin/plugin_config.html @@ -7,6 +7,11 @@ var ourTable = $(this).parents(".extensible-table") var lastRow = $(ourTable).find(".list-field:last") var newRow = $(lastRow).clone() + lastRow.show() + var inputFields = lastRow.find("input") + for (i = 0; i < inputFields.length; i++) { + $(inputFields[i]).prop("disabled", false) + } var lastIndex = parseInt(newRow.find("td:first").text()) newRow.find("td:first").text(lastIndex + 1) var inputFields = newRow.find("input") @@ -116,6 +121,20 @@ {% endfor -%} + + {%- set basename = "%s %d-"|format(v.name, value|length) -%} + + {{value|length + 1}} + + + + + + + + @@ -152,6 +171,25 @@ {% endfor -%} + + {%- set basename = "%s %d-"|format(v.name, value|length) -%} + + {{value|length + 1}} + + + + + + + + + + + + -- cgit