diff options
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/index.html | 6 | ||||
-rw-r--r-- | 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 @@ | |||
21 | <div id="app" @drop="drop" @dragover="dragOver"> | 21 | <div id="app" @drop="drop" @dragover="dragOver"> |
22 | 22 | ||
23 | <el-container> | 23 | <el-container> |
24 | <input type="file" ref="upload" style="display: none" id="uploadInput" multiple webkitdirectory="" directory=""/> | 24 | <input type="file" ref="upload" style="display: none" multiple/> |
25 | <input type="file" ref="uploadFolder" style="display: none" multiple webkitdirectory directory/> | ||
25 | 26 | ||
26 | <el-dialog title="Login" :visible.sync="ready && !session.valid" width="30%" :close-on-press-escape="false" :show-close="false"> | 27 | <el-dialog title="Login" :visible.sync="ready && !session.valid" width="30%" :close-on-press-escape="false" :show-close="false"> |
27 | <el-form :model="loginData" label-position="top" @submit.native.prevent> | 28 | <el-form :model="loginData" label-position="top" @submit.native.prevent> |
@@ -51,7 +52,8 @@ | |||
51 | </div> | 52 | </div> |
52 | <div align="right" v-show="session.valid"> | 53 | <div align="right" v-show="session.valid"> |
53 | <el-button-group> | 54 | <el-button-group> |
54 | <el-button type="primary" icon="el-icon-upload" size="small" @click="onUpload">Upload</el-button> | 55 | <el-button type="primary" icon="el-icon-upload2" size="small" @click="onUpload">Upload File</el-button> |
56 | <el-button type="primary" icon="el-icon-upload" size="small" @click="onUploadFolder">Upload Folder</el-button> | ||
55 | <el-button type="primary" icon="el-icon-plus" size="small" @click="onNewFolder">New Folder</el-button> | 57 | <el-button type="primary" icon="el-icon-plus" size="small" @click="onNewFolder">New Folder</el-button> |
56 | </el-button-group> | 58 | </el-button-group> |
57 | <el-dropdown @command="onOptionsMenu"> | 59 | <el-dropdown @command="onOptionsMenu"> |
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({ | |||
256 | var that = this; | 256 | var that = this; |
257 | 257 | ||
258 | $(this.$refs.upload).on('change', function () { | 258 | $(this.$refs.upload).on('change', function () { |
259 | |||
260 | // detach event handler | 259 | // detach event handler |
261 | $(that.$refs.upload).off('change'); | 260 | $(that.$refs.upload).off('change'); |
262 | |||
263 | uploadFiles(that.$refs.upload.files || []); | 261 | uploadFiles(that.$refs.upload.files || []); |
264 | }); | 262 | }); |
265 | 263 | ||
@@ -267,6 +265,19 @@ var app = new Vue({ | |||
267 | this.$refs.upload.value = ''; | 265 | this.$refs.upload.value = ''; |
268 | this.$refs.upload.click(); | 266 | this.$refs.upload.click(); |
269 | }, | 267 | }, |
268 | onUploadFolder: function () { | ||
269 | var that = this; | ||
270 | |||
271 | $(this.$refs.uploadFolder).on('change', function () { | ||
272 | // detach event handler | ||
273 | $(that.$refs.uploadFolder).off('change'); | ||
274 | uploadFiles(that.$refs.uploadFolder.files || []); | ||
275 | }); | ||
276 | |||
277 | // reset the form first to make the change handler retrigger even on the same file selected | ||
278 | this.$refs.uploadFolder.value = ''; | ||
279 | this.$refs.uploadFolder.click(); | ||
280 | }, | ||
270 | onDelete: function (entry) { | 281 | onDelete: function (entry) { |
271 | var that = this; | 282 | var that = this; |
272 | 283 | ||