From 3331cdd74abb89692c9d37ba503a9d36768ae7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Wed, 23 Oct 2019 18:40:48 +0200 Subject: [PATCH] Fix legacy tab backbone fileinfo change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/files/src/components/LegacyTab.vue | 7 ++++++- apps/files/src/views/Sidebar.vue | 20 +++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/apps/files/src/components/LegacyTab.vue b/apps/files/src/components/LegacyTab.vue index 9a85ee7f07..54a24edcdd 100644 --- a/apps/files/src/components/LegacyTab.vue +++ b/apps/files/src/components/LegacyTab.vue @@ -40,7 +40,6 @@ export default { }, name: { type: String, - default: '', required: true }, fileInfo: { @@ -74,10 +73,16 @@ export default { } } }, + beforeMount() { + this.setFileInfo(this.fileInfo) + }, mounted() { // append the backbone element and set the FileInfo this.component.$el.appendTo(this.$el) }, + beforeDestroy() { + this.component.remove() + }, methods: { setFileInfo(fileInfo) { this.component.setFileInfo(new OCA.Files.FileInfoModel(fileInfo)) diff --git a/apps/files/src/views/Sidebar.vue b/apps/files/src/views/Sidebar.vue index 879f71d8a1..02913d3687 100644 --- a/apps/files/src/views/Sidebar.vue +++ b/apps/files/src/views/Sidebar.vue @@ -26,6 +26,7 @@ ref="sidebar" v-bind="appSidebar" @close="onClose" + @update:active="setActiveTab" @update:starred="toggleStarred" @[defaultActionListener].stop.prevent="onDefaultAction"> @@ -50,6 +51,7 @@ :key="tab.id" :component="tabComponent(tab).component" :name="tab.name" + :dav-path="davPath" :file-info="fileInfo" /> @@ -121,13 +123,8 @@ export default { * @param {string} id the tab id to set as active * @returns {string} the current active tab */ - activeTab: { - get: function() { - return this.Sidebar.activeTab - }, - set: function(id) { - OCA.Files.Sidebar.activeTab = id - } + activeTab() { + return this.Sidebar.activeTab }, /** @@ -294,6 +291,15 @@ export default { } }, + /** + * Set current active tab + * + * @param {string} id tab unique id + */ + setActiveTab(id) { + OCA.Files.Sidebar.activeTab = id + }, + /** * Toggle favourite state * TODO: better implementation