From 93271d6c846ca3c330b61fedf9d139143dc8948f Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 1 Nov 2021 18:32:01 +0000 Subject: [PATCH] . --- rapids/templates/rapids/rapid_form.html | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/rapids/templates/rapids/rapid_form.html b/rapids/templates/rapids/rapid_form.html index 16964d86..efb7544a 100755 --- a/rapids/templates/rapids/rapid_form.html +++ b/rapids/templates/rapids/rapid_form.html @@ -8,6 +8,8 @@ let normal = false; + let active_file_inputs = new Set() + function showEditPopup(url) { var win = window.open(url, "Edit", 'height=500,width=800,resizable=yes,scrollbars=yes'); @@ -83,7 +85,6 @@ file = evt.target.files[0]; $(evt.target).removeClass("image-ident-warning"); $(evt.target).removeClass("image-ident-ok"); - //updateFileList(); console.log("input change1", evt); @@ -130,15 +131,6 @@ } - function updateFileList() { - // Why do we update everything here? - $("#image_form_set input[type=file]").each((n, el) => { - }) - - - } - - $(document).ready(function () { $("#add_abnormality").appendTo($("label[for='id_abnormality']")); @@ -220,7 +212,6 @@ evt.preventDefault(); evt.stopPropagation(); - //updateFileList(); }; @@ -359,6 +350,7 @@ }); } + active_file_inputs.add(el) const readFile = (file, el) => { reader(file).then(reader => { var image = new Image(); @@ -370,7 +362,11 @@ $(el).parent().parent().find(".temp-thumb").remove(); $(el).parent().parent().prepend(image); //images.push(reader.result); - loadViewer(); + + active_file_inputs.delete(el) + if (active_file_inputs.length < 1) { + loadViewer(); + } }); }