From 0905e3c293ceb0f1d769513870c3931530d6331d Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Mon, 24 Feb 2020 23:24:07 +0100
Subject: viewer: disable the back command to prevent exiting the gallery

GitHub: Resolves #91
---
 viewer/src/components/LdCommand.vue | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'viewer/src/components/LdCommand.vue')

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 @@
     <a class="link" :title="$t('command.search')" @click="$uiStore.toggleFullWidth()">
       <fa-icon :icon="commandToggleSearchPanelIcon()" size="lg" />
     </a>
-    <a class="link command-secondary" :title="$t('command.back')" @click="$router.go(-1)">
+    <a
+      :class="{'disabled': isEntryPoint()}"
+      class="link command-secondary"
+      :title="$t('command.back')"
+      @click="isEntryPoint() || $router.back()"
+    >
       <fa-icon icon="arrow-left" size="lg" />
     </a>
     <router-link :class="{'disabled': isRoot()}" :title="$t('command.parent')" :to="parent()">
@@ -49,6 +54,10 @@ export default class LdCommand extends Vue {
     return this.currentItemPath.length <= 1 && !this.$uiStore.searchMode;
   }
 
+  isEntryPoint(): boolean {
+    return history.state.ldgallery === "ENTRYPOINT"; // Set by MainLayout.vue
+  }
+
   parent(): RawLocation {
     if (this.$uiStore.searchMode) return this.$route.path;
     if (this.currentItemPath.length > 1) return this.currentItemPath[this.currentItemPath.length - 2];
-- 
cgit v1.2.3

