From 6ebb1216fe4ef77a223fb0b2e3eea5db4091ca29 Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Fri, 19 Jan 2018 13:34:15 -0500 Subject: [PATCH 1/2] prevent user from selecting multiple files when clicking upload button if preventMultipleFiles is set --- addon/components/dropzone-widget/component.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addon/components/dropzone-widget/component.js b/addon/components/dropzone-widget/component.js index 8cf02a404..40e4680a6 100644 --- a/addon/components/dropzone-widget/component.js +++ b/addon/components/dropzone-widget/component.js @@ -80,6 +80,14 @@ export default Ember.Component.extend({ } }); + // Dropzone.js does not have an option for disabling selecting multiple files when clicking the "upload" button. + // Therefore, we remove the "multiple" attribute for the hidden file input element, so that users cannot select + // multiple files for upload in the first place. + let clickableElement = this.get('clickable'); + if (this.options.preventMultipleFiles && clickableElement){ + Ember.$('.dz-hidden-input').removeAttr('multiple'); + } + this.set('dropzoneElement', drop); // Set osf session header From 56ba64da243bae011f787e58b0f1ac83e60ed8b0 Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Wed, 24 Jan 2018 11:51:30 -0500 Subject: [PATCH 2/2] cleanup --- CHANGELOG.md | 1 + addon/components/dropzone-widget/component.js | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b0bdc695..1725969fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Margins for scrollbar on `file-browser` - Clickability on dropzone widget - Handle Dropzone enable/disable properly +- Prevent users from selecting multiple files by clicking 'Upload' button in Quickfiles ## [0.12.4] - 2017-12-04 ### Added diff --git a/addon/components/dropzone-widget/component.js b/addon/components/dropzone-widget/component.js index 40e4680a6..4348ed7c2 100644 --- a/addon/components/dropzone-widget/component.js +++ b/addon/components/dropzone-widget/component.js @@ -83,8 +83,7 @@ export default Ember.Component.extend({ // Dropzone.js does not have an option for disabling selecting multiple files when clicking the "upload" button. // Therefore, we remove the "multiple" attribute for the hidden file input element, so that users cannot select // multiple files for upload in the first place. - let clickableElement = this.get('clickable'); - if (this.options.preventMultipleFiles && clickableElement){ + if (this.get('options.preventMultipleFiles') && this.get('clickable')){ Ember.$('.dz-hidden-input').removeAttr('multiple'); }