Fix legacy tab backbone fileinfo change

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2019-10-23 18:40:48 +02:00 committed by Daniel Calviño Sánchez
parent 51960cb228
commit 3331cdd74a
2 changed files with 19 additions and 8 deletions

View File

@ -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))

View File

@ -26,6 +26,7 @@
ref="sidebar"
v-bind="appSidebar"
@close="onClose"
@update:active="setActiveTab"
@update:starred="toggleStarred"
@[defaultActionListener].stop.prevent="onDefaultAction">
<!-- TODO: create a standard to allow multiple elements here? -->
@ -50,6 +51,7 @@
:key="tab.id"
:component="tabComponent(tab).component"
:name="tab.name"
:dav-path="davPath"
:file-info="fileInfo" />
</template>
</AppSidebar>
@ -121,14 +123,9 @@ export default {
* @param {string} id the tab id to set as active
* @returns {string} the current active tab
*/
activeTab: {
get: function() {
activeTab() {
return this.Sidebar.activeTab
},
set: function(id) {
OCA.Files.Sidebar.activeTab = id
}
},
/**
* Sidebar subtitle
@ -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