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:
parent
e4dac2ca7f
commit
10ecf0fbb0
2 changed files with 70 additions and 45 deletions
|
@ -47,6 +47,10 @@ export default Ember.Component.extend({
|
|||
// TODO: refactor to eliminate self
|
||||
let self = this;
|
||||
|
||||
if (is.null(self.get('target'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
let drop = this.get('tether').createDrop({
|
||||
target: document.getElementById(self.get('target')),
|
||||
content: self.$(".dropdown-dialog")[0],
|
||||
|
|
|
@ -57,8 +57,39 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
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 folderId = this.get('folder.id');
|
||||
let url = this.get('appMeta.endpoint');
|
||||
|
@ -102,16 +133,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
});
|
||||
|
||||
this.set('drop', dzone);
|
||||
}
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
if (is.not.null(this.get('drop'))) {
|
||||
this.get('drop').destroy();
|
||||
this.set('drop', null);
|
||||
}
|
||||
|
||||
this.destroyTooltips();
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue