From 7c36adbbc51c85c9073c72e75d6503b52c02561d Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Fri, 18 May 2018 21:23:02 +0200 Subject: [PATCH] We cannot have one button/input type for both folders and files for upload --- frontend/index.html | 6 ++++-- frontend/js/app.js | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 538d329..d2b526d 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -21,7 +21,8 @@
- + + @@ -51,7 +52,8 @@
- Upload + Upload File + Upload Folder New Folder diff --git a/frontend/js/app.js b/frontend/js/app.js index dce3a60..9d7baca 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -256,10 +256,8 @@ var app = new Vue({ var that = this; $(this.$refs.upload).on('change', function () { - // detach event handler $(that.$refs.upload).off('change'); - uploadFiles(that.$refs.upload.files || []); }); @@ -267,6 +265,19 @@ var app = new Vue({ this.$refs.upload.value = ''; this.$refs.upload.click(); }, + onUploadFolder: function () { + var that = this; + + $(this.$refs.uploadFolder).on('change', function () { + // detach event handler + $(that.$refs.uploadFolder).off('change'); + uploadFiles(that.$refs.uploadFolder.files || []); + }); + + // reset the form first to make the change handler retrigger even on the same file selected + this.$refs.uploadFolder.value = ''; + this.$refs.uploadFolder.click(); + }, onDelete: function (entry) { var that = this; -- 2.41.0