aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-01-06 11:26:06 -0600
committerFrederick Muriuki Muriithi2025-01-06 11:26:06 -0600
commit3e71a2eec8507f900e51dd3962d76aa4ba272fbb (patch)
tree5e2d939154e1dd3c774c18c9216c87384375fa09
parent568fee5a9dd8d7b689af5e0486990f307c59287c (diff)
downloadgn-uploader-3e71a2eec8507f900e51dd3962d76aa4ba272fbb.tar.gz
Make the preview updater more generic
Build the preview-updater in a function call to ease maintenance.
-rw-r--r--uploader/templates/phenotypes/add-phenotypes-raw-files.html26
1 files changed, 13 insertions, 13 deletions
diff --git a/uploader/templates/phenotypes/add-phenotypes-raw-files.html b/uploader/templates/phenotypes/add-phenotypes-raw-files.html
index 3eb042e..8a7463a 100644
--- a/uploader/templates/phenotypes/add-phenotypes-raw-files.html
+++ b/uploader/templates/phenotypes/add-phenotypes-raw-files.html
@@ -400,6 +400,16 @@
}
};
+ var makePreviewUpdater = (preview_table) => {
+ return (data) => {
+ update_preview(
+ preview_table,
+ data,
+ filesMetadata(),
+ PREVIEW_ROWS);
+ };
+ };
+
var preview_tables_to_elements_map = {
"#tbl-preview-pheno-desc": "#finput-phenotype-descriptions",
"#tbl-preview-pheno-data": "#finput-phenotype-data",
@@ -426,12 +436,7 @@
readFirstNLines(
file_input[0].files[0],
10,
- [(data) => {
- update_preview(
- $(mapentry[0]),
- data,
- files_metadata(),
- PREVIEW_ROWS);}]);
+ [makePreviewUpdater(preview_table)]);
}
});
};
@@ -454,13 +459,8 @@
readFirstNLines(
event.target.files[0],
10,
- [(data) => {
- update_preview(
- $("#" + event.target.getAttribute("data-preview-table")),
- data,
- files_metadata(),
- PREVIEW_ROWS);
- }]);
+ [makePreviewUpdater(
+ $("#" + event.target.getAttribute("data-preview-table")))]);
});
});