diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-12-03 20:33:25 +0300 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-12-05 18:44:41 +0300 |
commit | ea4f2533352d93ee008d4b1c574eb303acdacad8 (patch) | |
tree | 5f959c5c1ac36f4b6e8bd707068e39c8b5240ef3 /src | |
parent | 92705ada08b5a3386730164763013cce0953431b (diff) |
Fix client load requirement for sidebar
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Navigation.vue | 15 | ||||
-rw-r--r-- | src/main.js | 9 | ||||
-rw-r--r-- | src/mixins/FileFolder.scss | 1 | ||||
-rw-r--r-- | src/router/index.js | 3 | ||||
-rw-r--r-- | src/views/Albums.vue | 15 | ||||
-rw-r--r-- | src/views/Tags.vue | 6 |
6 files changed, 41 insertions, 8 deletions
diff --git a/src/components/Navigation.vue b/src/components/Navigation.vue index 0102315f..85c8b004 100644 --- a/src/components/Navigation.vue +++ b/src/components/Navigation.vue @@ -32,7 +32,7 @@ <h2 class="photos-navigation__title"> {{ name }} </h2> - <Actions class="photos-navigation__share"> + <Actions v-if="!isRoot && showActions" class="photos-navigation__share"> <ActionButton icon="icon-shared" @click="showSidebar"> @@ -63,6 +63,10 @@ export default { type: String, required: true, }, + showActions: { + type: Boolean, + default: false, + }, rootTitle: { type: String, default: t('photos', 'Photos'), @@ -92,7 +96,7 @@ export default { }, backToText() { if (this.parentPath === '/') { - return t('photos', 'Back to home') + return t('photos', 'Back to {folder}', { folder: this.rootTitle }) } return t('photos', 'Back to {folder}', { folder: this.parentName }) }, @@ -132,8 +136,8 @@ export default { }, showSidebar() { OCA.Files.Sidebar.open(this.filename) - - } + + }, }, } </script> @@ -151,6 +155,9 @@ export default { &__title { margin: 0; } + &__share { + margin-left: 10px; + } } // generate variants based on grid sizes diff --git a/src/main.js b/src/main.js index 5e4a96d3..301632ed 100644 --- a/src/main.js +++ b/src/main.js @@ -46,6 +46,15 @@ sync(store, router) Vue.prototype.t = translate Vue.prototype.n = translatePlural +// TODO: remove when we have a proper fileinfo standalone library +window.addEventListener('DOMContentLoaded', () => { + // register unused client for the sidebar to have access to its parser methods + if (!window.OCA.Files) { + window.OCA.Files = {} + } + Object.assign(window.OCA.Files, { App: { fileList: { filesClient: OC.Files.getClient() } } }, window.OCA.Files) +}) + export default new Vue({ el: '#content', // eslint-disable-next-line vue/match-component-file-name diff --git a/src/mixins/FileFolder.scss b/src/mixins/FileFolder.scss index 7dc06c06..dcac1981 100644 --- a/src/mixins/FileFolder.scss +++ b/src/mixins/FileFolder.scss @@ -26,6 +26,7 @@ display: flex; align-items: center; justify-content: center; + user-select: none; .cover { z-index: 2; diff --git a/src/router/index.js b/src/router/index.js index c6cc453c..1d3c20cd 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -57,6 +57,7 @@ export default new Router({ path: `/${route.params.path ? route.params.path : ''}`, // if path is empty isRoot: !route.params.path, + rootTitle: t('photos', 'Your albums'), }), }, { @@ -68,6 +69,7 @@ export default new Router({ path: `/${route.params.path ? route.params.path : ''}`, // if path is empty isRoot: !route.params.path, + rootTitle: t('photos', 'Shared albums'), showShared: true, }), }, @@ -87,6 +89,7 @@ export default new Router({ path: `${route.params.path ? route.params.path : ''}`, // if path is empty isRoot: !route.params.path, + rootTitle: t('photos', 'Tagged photos'), }), }, { diff --git a/src/views/Albums.vue b/src/views/Albums.vue index 54ff735c..fa5ad09f 100644 --- a/src/views/Albums.vue +++ b/src/views/Albums.vue @@ -34,7 +34,11 @@ <!-- Folder content --> <Grid v-else> - <Navigation v-if="folder" key="navigation" v-bind="folder" /> + <Navigation v-if="folder" + key="navigation" + v-bind="folder" + :root-title="rootTitle" + :show-actions="true" /> <Folder v-for="dir in folderList" :key="dir.fileid" @@ -67,6 +71,10 @@ export default { Navigation, }, props: { + rootTitle: { + type: String, + required: true, + }, path: { type: String, default: '/', @@ -163,8 +171,9 @@ export default { // cancel any pending requests this.cancelRequest('Changed folder') - // close any potential opened viewer - OCA.Viewer.close() + // close any potential opened viewer & sidebar + OCA.Viewer && OCA.Viewer.close() + OCA.Files && OCA.Files.Sidebar.close() // if we don't already have some cached data let's show a loader if (!this.files[this.folderId]) { diff --git a/src/views/Tags.vue b/src/views/Tags.vue index 30407b55..2b05c7aa 100644 --- a/src/views/Tags.vue +++ b/src/views/Tags.vue @@ -38,7 +38,7 @@ key="navigation" :basename="path" :filename="'/' + path" - :root-title="t('photos', 'Tags')" /> + :root-title="rootTitle" /> <template v-if="isRoot"> <Tag v-for="id in tagsNames" :key="id" @@ -76,6 +76,10 @@ export default { Navigation, }, props: { + rootTitle: { + type: String, + required: true, + }, path: { type: String, default: '', |