diff options
author | Zero~Informatique | 2020-02-24 23:24:07 +0100 |
---|---|---|
committer | Zero~Informatique | 2020-02-24 23:24:07 +0100 |
commit | 0905e3c293ceb0f1d769513870c3931530d6331d (patch) | |
tree | 9ad3b381e6c2078c6c2d9d6ddcedb728684dd628 | |
parent | 2a458e25c0510798120dddbd85cef5ee440c2a2a (diff) | |
download | ldgallery-0905e3c293ceb0f1d769513870c3931530d6331d.tar.gz |
viewer: disable the back command to prevent exiting the gallery
GitHub: Resolves #91
-rw-r--r-- | viewer/src/components/LdCommand.vue | 11 | ||||
-rw-r--r-- | viewer/src/views/MainLayout.vue | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/viewer/src/components/LdCommand.vue b/viewer/src/components/LdCommand.vue index c0b86be..367e08f 100644 --- a/viewer/src/components/LdCommand.vue +++ b/viewer/src/components/LdCommand.vue | |||
@@ -23,7 +23,12 @@ | |||
23 | <a class="link" :title="$t('command.search')" @click="$uiStore.toggleFullWidth()"> | 23 | <a class="link" :title="$t('command.search')" @click="$uiStore.toggleFullWidth()"> |
24 | <fa-icon :icon="commandToggleSearchPanelIcon()" size="lg" /> | 24 | <fa-icon :icon="commandToggleSearchPanelIcon()" size="lg" /> |
25 | </a> | 25 | </a> |
26 | <a class="link command-secondary" :title="$t('command.back')" @click="$router.go(-1)"> | 26 | <a |
27 | :class="{'disabled': isEntryPoint()}" | ||
28 | class="link command-secondary" | ||
29 | :title="$t('command.back')" | ||
30 | @click="isEntryPoint() || $router.back()" | ||
31 | > | ||
27 | <fa-icon icon="arrow-left" size="lg" /> | 32 | <fa-icon icon="arrow-left" size="lg" /> |
28 | </a> | 33 | </a> |
29 | <router-link :class="{'disabled': isRoot()}" :title="$t('command.parent')" :to="parent()"> | 34 | <router-link :class="{'disabled': isRoot()}" :title="$t('command.parent')" :to="parent()"> |
@@ -49,6 +54,10 @@ export default class LdCommand extends Vue { | |||
49 | return this.currentItemPath.length <= 1 && !this.$uiStore.searchMode; | 54 | return this.currentItemPath.length <= 1 && !this.$uiStore.searchMode; |
50 | } | 55 | } |
51 | 56 | ||
57 | isEntryPoint(): boolean { | ||
58 | return history.state.ldgallery === "ENTRYPOINT"; // Set by MainLayout.vue | ||
59 | } | ||
60 | |||
52 | parent(): RawLocation { | 61 | parent(): RawLocation { |
53 | if (this.$uiStore.searchMode) return this.$route.path; | 62 | if (this.$uiStore.searchMode) return this.$route.path; |
54 | if (this.currentItemPath.length > 1) return this.currentItemPath[this.currentItemPath.length - 2]; | 63 | if (this.currentItemPath.length > 1) return this.currentItemPath[this.currentItemPath.length - 2]; |
diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue index 272c045..2d74db9 100644 --- a/viewer/src/views/MainLayout.vue +++ b/viewer/src/views/MainLayout.vue | |||
@@ -43,6 +43,7 @@ export default class MainLayout extends Vue { | |||
43 | scrollPositions: ScrollPosition = {}; | 43 | scrollPositions: ScrollPosition = {}; |
44 | 44 | ||
45 | mounted() { | 45 | mounted() { |
46 | history.replaceState({ ldgallery: "ENTRYPOINT" }, ""); | ||
46 | this.fetchGalleryItems(); | 47 | this.fetchGalleryItems(); |
47 | } | 48 | } |
48 | 49 | ||