1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-10 07:55:25 +02:00

fixed dele error: 'Dropzone already attached'

This commit is contained in:
Harvey Kandola 2016-05-23 11:20:22 -07:00
parent 77849d175f
commit 0ce9ab406e
2 changed files with 23 additions and 6 deletions

View file

@ -13,17 +13,24 @@ import Ember from 'ember';
import NotifierMixin from '../../mixins/notifier';
export default Ember.Component.extend(NotifierMixin, {
tagName: 'span',
selectedTemplate: {
id: "0"
},
canEditTemplate: "",
drop: null,
didReceiveAttrs() {
this.send('setTemplate', this.get('savedTemplates')[0]);
},
willDestroyElement() {
if (is.not.null(this.get('drop'))) {
this.get('drop').destroy();
this.set('drop', null);
}
},
actions: {
setTemplate(chosen) {
if (is.undefined(chosen)) {
@ -58,10 +65,16 @@ export default Ember.Component.extend(NotifierMixin, {
},
onOpenCallback() {
if (is.not.null(this.get('drop'))) {
return;
}
let self = this;
let folderId = this.get('folder.id');
let importUrl = this.session.appMeta.getUrl('import/folder/' + folderId);
Dropzone.options.uploadDocuments = false;
let dzone = new Dropzone("#upload-documents", {
headers: {
'Authorization': 'Bearer ' + self.session.getSessionItem('token')
@ -86,7 +99,8 @@ export default Ember.Component.extend(NotifierMixin, {
console.log("Conversion failed for ", x.name, " obj ", x); // TODO proper error handling
});
this.on("queuecomplete", function() {});
this.on("queuecomplete", function() {
});
this.on("addedfile", function(file) {
self.attrs.onDocumentImporting(file.name);
@ -98,6 +112,8 @@ export default Ember.Component.extend(NotifierMixin, {
dzone.on("complete", function(file) {
dzone.removeFile(file);
});
this.set('drop', dzone);
}
}
});

View file

@ -4,6 +4,7 @@
</div>
<p class="heading">Or use a template:</p>
<ul class="start-document-options" style="min-width:185px;">
{{#each savedTemplates key="id" as |template|}}
<li class="option {{if template.selected "selected"}}" {{action 'setTemplate' template}}>