aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/views/Gallery.vue
diff options
context:
space:
mode:
authorZero~Informatique2020-01-09 02:10:35 +0100
committerZero~Informatique2020-01-09 02:10:35 +0100
commit89bcb2dbe5b5e6eb8e8ba13ceecee2770dfe4cd4 (patch)
tree8eb2c100707123f77ff6980c94e161d6214c648f /viewer/src/views/Gallery.vue
parentc1e334b883e28381851fca077ff36aee0387b1db (diff)
downloadldgallery-89bcb2dbe5b5e6eb8e8ba13ceecee2770dfe4cd4.tar.gz
viewer: Changed "image" type to "picture". Adapted the code to the current compiler output format. The currentItem and currentPath are calculated in the store for easier multi-component access. Breadcrumb for current's position and navigation.
Diffstat (limited to 'viewer/src/views/Gallery.vue')
-rw-r--r--viewer/src/views/Gallery.vue36
1 files changed, 19 insertions, 17 deletions
diff --git a/viewer/src/views/Gallery.vue b/viewer/src/views/Gallery.vue
index 4deb937..a53df3d 100644
--- a/viewer/src/views/Gallery.vue
+++ b/viewer/src/views/Gallery.vue
@@ -1,32 +1,41 @@
1<template> 1<template>
2 <div> 2 <div>
3 <gallery-search v-if="$uiStore.isModeSearch" :items="currentSearch" /> 3 <gallery-search v-if="$uiStore.isModeSearch" :items="currentSearch" />
4 <gallery-directory v-else-if="isDirectory" :directory="currentItem" /> 4 <gallery-directory v-else-if="isDirectory" :directory="$galleryStore.currentItem" />
5 <gallery-image v-else-if="isImage" :image="currentItem" /> 5 <gallery-picture v-else-if="isPicture" :picture="$galleryStore.currentItem" />
6 <div v-else>Unknown type</div> 6 <div v-else>{{$t("gallery.unknowntype")}}</div>
7 </div> 7 </div>
8</template> 8</template>
9 9
10<script lang="ts"> 10<script lang="ts">
11import { Component, Vue, Prop } from "vue-property-decorator"; 11import { Component, Vue, Prop, Watch } from "vue-property-decorator";
12import { Operation } from '@/@types/tag/Operation'; 12import { Operation } from '@/@types/tag/Operation';
13import GallerySearch from "./GallerySearch.vue"; 13import GallerySearch from "./GallerySearch.vue";
14import GalleryDirectory from "./GalleryDirectory.vue"; 14import GalleryDirectory from "./GalleryDirectory.vue";
15import GalleryImage from "./GalleryImage.vue"; 15import GalleryPicture from "./GalleryPicture.vue";
16import GalleryStore from "../store/galleryStore";
17 16
18@Component({ 17@Component({
19 components: { GallerySearch, GalleryDirectory, GalleryImage }, 18 components: { GallerySearch, GalleryDirectory, GalleryPicture },
20}) 19})
21export default class Gallery extends Vue { 20export default class Gallery extends Vue {
22 @Prop(String) readonly pathMatch!: string; 21 @Prop(String) readonly pathMatch!: string;
23 22
23 mounted() {
24 this.pathChanged()
25 }
26
27 @Watch("pathMatch")
28 pathChanged() {
29 console.log("Path: ", this.pathMatch);
30 this.$galleryStore.setCurrentPath(this.pathMatch);
31 }
32
24 get isDirectory(): boolean { 33 get isDirectory(): boolean {
25 return this.checkType("directory"); 34 return this.checkType("directory");
26 } 35 }
27 36
28 get isImage(): boolean { 37 get isPicture(): boolean {
29 return this.checkType("image"); 38 return this.checkType("picture");
30 } 39 }
31 40
32 // Results of the search (by tags) 41 // Results of the search (by tags)
@@ -37,17 +46,10 @@ export default class Gallery extends Vue {
37 return this.aggregateAll(byOperation, intersection, substraction); 46 return this.aggregateAll(byOperation, intersection, substraction);
38 } 47 }
39 48
40 // Item pointed by the URL (navigation)
41 get currentItem(): Gallery.Item | null {
42 const galleryItemsRoot = this.$galleryStore.galleryItemsRoot;
43 if (galleryItemsRoot) return GalleryStore.searchCurrentItem(galleryItemsRoot, this.pathMatch);
44 return null;
45 }
46
47 // --- 49 // ---
48 50
49 private checkType(type: string): boolean { 51 private checkType(type: string): boolean {
50 return this.currentItem?.properties.type === type ?? false; 52 return this.$galleryStore.currentItem?.properties.type === type ?? false;
51 } 53 }
52 54
53 private extractTagsByOperation(currentTags: Tag.Search[]): Tag.SearchByOperation { 55 private extractTagsByOperation(currentTags: Tag.Search[]): Tag.SearchByOperation {