diff options
author | Peter Grassberger <petertheone@gmail.com> | 2016-02-22 17:48:35 (GMT) |
---|---|---|
committer | Peter Grassberger <petertheone@gmail.com> | 2016-02-22 17:48:35 (GMT) |
commit | 13fc3657a2668d83f70636ac4d1156d38a1b1007 (patch) | |
tree | 7fd3b27016c930445ed462aec3a0321a26d89e06 /www/js | |
parent | 7262a8e91ca8bb14bf58af8f8cf89e351aff288e (diff) |
destroy dropzone on cancel, success and modal hide
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/importer.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/www/js/importer.js b/www/js/importer.js index 06caa1c..c5b48df 100644 --- a/www/js/importer.js +++ b/www/js/importer.js @@ -55,6 +55,12 @@ Rivendell.Importer.prototype.openModal = function(group, groupView, createCart, autoProcessQueue: false }); + this.$el.off('hide.bs.modal').on('hide.bs.modal', function() { + dropzone.removeAllFiles(true); + dropzone.disable(); + dropzone.destroy(); + }); + var self = this; dropzone.on('addedfile', function(file) { if (!Dropzone.isValidFile(file, dropzone.options.acceptedFiles)) { @@ -71,10 +77,12 @@ Rivendell.Importer.prototype.openModal = function(group, groupView, createCart, var upload = new Rivendell.Upload(group, groupView, createCart, newCartNumber, useMetadata, dropzone); self.uploads.push(upload); + self.$el.off('hide.bs.modal'); self.$el.modal('hide'); }) .removeAttr('disabled').focus(); }); + this.$el.modal({keyboard: true}); }; @@ -113,6 +121,7 @@ Rivendell.Upload.prototype.cancel = function() { this.dropzone.off(Dropzone.ERROR); this.dropzone.removeAllFiles(true); this.dropzone.disable(); + this.dropzone.destroy(); var self = this; if (this.createCart && this.cart !== null) { @@ -172,10 +181,10 @@ Rivendell.Upload.prototype.importFileUploadSuccess = function() { this.dropzone.off(Dropzone.ERROR); this.dropzone.removeAllFiles(true); this.dropzone.disable(); + this.dropzone.destroy(); + importer.removeUpload(this); this.group.fetchCarts(); - - importer.removeUpload(this); }; Rivendell.Upload.prototype.importFileUploadError = function(file, msg, xhr) { |