Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/files/js/dist/sidebar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files/js/dist/sidebar.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files/js/fileactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
// close sidebar on delete
const path = context.dir + '/' + fileName
if (OCA.Files.Sidebar && OCA.Files.Sidebar.file === path) {
OCA.Files.Sidebar.file = undefined
OCA.Files.Sidebar.close()
}
}
});
Expand Down
6 changes: 3 additions & 3 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@
console.warn('showDetailsView is deprecated! Use OCA.Files.Sidebar.activeTab. It will be removed in nextcloud 20.');
this._updateDetailsView(fileName);
if (tabId) {
OCA.Files.Sidebar.activeTab = tabId;
OCA.Files.Sidebar.setActiveTab(tabId);
}
},

Expand All @@ -630,7 +630,7 @@
}

if (!fileName) {
OCA.Files.Sidebar.file = null
OCA.Files.Sidebar.close()
return
} else if (typeof fileName !== 'string') {
fileName = ''
Expand All @@ -644,7 +644,7 @@
var path = model.attributes.path + '/' + model.attributes.name

// open sidebar and set file
OCA.Files.Sidebar.file = path.replace('//', '/')
OCA.Files.Sidebar.open(path.replace('//', '/'))
},

/**
Expand Down
28 changes: 18 additions & 10 deletions apps/files/src/services/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ export default class Sidebar {
}

/**
* @memberof Sidebar
* Register a new tab view
*
* @param {Object} tab a new unregistered tab
* @memberof Sidebar
* @param {Object} tab a new unregistered tab
* @returns {Boolean}
*/
registerTab(tab) {
Expand All @@ -77,32 +76,41 @@ export default class Sidebar {
}

/**
* Set the current sidebar file data
* Open the sidebar for the given file
*
* @param {string} path the file path to load
* @memberof Sidebar
* @param {string} path the file path to load
*/
set file(path) {
open(path) {
this.#state.file = path
}

/**
* Set the current sidebar file data
* Close the sidebar
*
* @memberof Sidebar
*/
close() {
this.#state.file = ''
}

/**
* Return current opened file
*
* @returns {String} the current opened file
* @memberof Sidebar
* @returns {String} the current opened file
*/
get file() {
return this.#state.file
}

/**
* Set the current sidebar tab
* Set the current visible sidebar tab
*
* @param {string} id the tab unique id
* @memberof Sidebar
* @param {string} id the tab unique id
*/
set activeTab(id) {
setActiveTab(id) {
this.#state.activeTab = id
}

Expand Down
4 changes: 2 additions & 2 deletions apps/files/src/views/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export default {
},
onClose() {
this.resetData()
OCA.Files.Sidebar.file = ''
OCA.Files.Sidebar.close()
},
resetData() {
this.error = null
Expand Down Expand Up @@ -297,7 +297,7 @@ export default {
* @param {string} id tab unique id
*/
setActiveTab(id) {
OCA.Files.Sidebar.activeTab = id
OCA.Files.Sidebar.setActiveTab(id)
},

/**
Expand Down