1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-20 13:49:42 +02:00

fixed bug with unnecessary document import init

This commit is contained in:
Harvey Kandola 2016-10-16 17:27:52 -07:00
parent e4dac2ca7f
commit 10ecf0fbb0
2 changed files with 70 additions and 45 deletions

View file

@ -47,6 +47,10 @@ export default Ember.Component.extend({
// TODO: refactor to eliminate self // TODO: refactor to eliminate self
let self = this; let self = this;
if (is.null(self.get('target'))) {
return;
}
let drop = this.get('tether').createDrop({ let drop = this.get('tether').createDrop({
target: document.getElementById(self.get('target')), target: document.getElementById(self.get('target')),
content: self.$(".dropdown-dialog")[0], content: self.$(".dropdown-dialog")[0],

View file

@ -57,8 +57,39 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
this.addTooltip(document.getElementById("import-document-button")); this.addTooltip(document.getElementById("import-document-button"));
} }
} }
},
didUpdate() {
this.setupImport();
},
didInsertElement() {
// this.setupImport();
},
willDestroyElement() {
if (is.not.null(this.get('drop'))) {
this.get('drop').destroy();
this.set('drop', null);
}
this.destroyTooltips();
},
setupImport() {
// guard against unecessary file upload component init
if (this.get('hasSelectedDocuments') || !this.get('folderService').get('canEditCurrentFolder')) {
return;
}
// already done init?
if (is.not.null(this.get('drop'))) {
if (is.not.null(this.get('drop'))) {
this.get('drop').destroy();
this.set('drop', null);
}
}
if (this.get('folderService').get('canEditCurrentFolder')) {
let self = this; let self = this;
let folderId = this.get('folder.id'); let folderId = this.get('folder.id');
let url = this.get('appMeta.endpoint'); let url = this.get('appMeta.endpoint');
@ -102,16 +133,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
}); });
this.set('drop', dzone); this.set('drop', dzone);
}
},
willDestroyElement() {
if (is.not.null(this.get('drop'))) {
this.get('drop').destroy();
this.set('drop', null);
}
this.destroyTooltips();
}, },
actions: { actions: {