From efe68644184c39676182fe76a5e9a7ea4bdc51d3 Mon Sep 17 00:00:00 2001 From: Michael Manfre Date: Tue, 27 Dec 2022 19:45:51 -0500 Subject: [PATCH] Ensure a min of 2 metadata input rows on profile edit form (#297) --- templates/forms/_json_name_value_list.html | 10 ++++++++-- users/views/settings/profile.py | 16 +++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/templates/forms/_json_name_value_list.html b/templates/forms/_json_name_value_list.html index 65a7262..a2b0459 100644 --- a/templates/forms/_json_name_value_list.html +++ b/templates/forms/_json_name_value_list.html @@ -42,11 +42,17 @@ set two to the first in f then set two@value to item.{{ name_two }} end + get the (@data-min-empty of #id_{{ field.name }}) + set min_empty to it + if items.length < min_empty then + repeat (min_empty - items.length) times + call {{ field.name }}.addEmptyField() + end ">
- +
@@ -58,7 +64,7 @@
-