aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader/static
diff options
context:
space:
mode:
Diffstat (limited to 'bh20simplewebuploader/static')
-rw-r--r--bh20simplewebuploader/static/main.css11
-rw-r--r--bh20simplewebuploader/static/main.js50
2 files changed, 28 insertions, 33 deletions
diff --git a/bh20simplewebuploader/static/main.css b/bh20simplewebuploader/static/main.css
index 30b1d04..609ae19 100644
--- a/bh20simplewebuploader/static/main.css
+++ b/bh20simplewebuploader/static/main.css
@@ -147,6 +147,17 @@ footer {
justify-content: space-around;
}
+.metadata input#metadata_upload:checked ~ #metadata_upload_form_spot {
+ display: block;
+}
+
+.metadata input#metadata_upload ~ #metadata_upload_form_spot {
+ display: none;
+}
+
+.invisible {
+ display: none;
+}
@media only screen and (max-device-width: 480px) {
.grid-container {
display: flex;
diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js
index ab810cd..e8d4776 100644
--- a/bh20simplewebuploader/static/main.js
+++ b/bh20simplewebuploader/static/main.js
@@ -1,37 +1,21 @@
-let r = new XMLHttpRequest();
-let test;
-r.open("GET", scriptRoot + "/api/getAllaccessions", true);
-r.onreadystatechange = function () {
- if (r.readyState != 4 || r.status != 200) return;
- test = r.responseText;
- console.log(JSON.parse(test));
-};
-r.send();
-let uploadForm = document.getElementById('metadata_upload_form')
-let uploadFormSpot = document.getElementById('metadata_upload_form_spot')
-let fillForm = document.getElementById('metadata_fill_form')
-let fillFormSpot = document.getElementById('metadata_fill_form_spot')
+fetch(scriptRoot + "/api/getAllaccessions")
+ .then(response => {
+ return response.json();
+ })
+ .then(data => {
+ console.log('test');
+ console.log(data);
+ })
-function setUploadMode() {
- // Make the upload form the one in use
- uploadFormSpot.appendChild(uploadForm)
- fillFormSpot.removeChild(fillForm)
-}
-
-function setFillMode() {
- // Make the fillable form the one in use
- uploadFormSpot.removeChild(uploadForm)
- fillFormSpot.appendChild(fillForm)
-}
-
-function setMode() {
- // Pick mode based on radio
- if (document.getElementById('metadata_upload').checked) {
- setUploadMode()
+/**
+ * Show form if checked
+ */
+let fillFormSpot = document.getElementById('metadata_fill_form_spot');
+function displayForm() {
+ if (document.getElementById('metadata_form').checked) {
+ fillFormSpot.classList.remove("invisible");
} else {
- setFillMode()
+ fillFormSpot.classList.add("invisible");
+ console.log("visible");
}
}
-
-// Start in mode appropriate to selected form item
-setMode()