diff options
author | Zero~Informatique | 2020-05-22 04:14:48 +0200 |
---|---|---|
committer | OzoneGrif | 2020-05-22 04:39:18 +0200 |
commit | 74c1c5e34787ac57299c8cbd874e9dcc56da406d (patch) | |
tree | 51da8090667290bc27e3580b9a78271ddf4d0e3a /viewer/src/views/GalleryNavigation.vue | |
parent | e20f99b74b55fdb3edbcfe5bfdb700fc1a5e9574 (diff) | |
download | ldgallery-74c1c5e34787ac57299c8cbd874e9dcc56da406d.tar.gz |
viewer: Enumerated item types
Diffstat (limited to 'viewer/src/views/GalleryNavigation.vue')
-rw-r--r-- | viewer/src/views/GalleryNavigation.vue | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/viewer/src/views/GalleryNavigation.vue b/viewer/src/views/GalleryNavigation.vue index 9fc40e1..b141d44 100644 --- a/viewer/src/views/GalleryNavigation.vue +++ b/viewer/src/views/GalleryNavigation.vue | |||
@@ -21,19 +21,26 @@ | |||
21 | <!-- TODO: eliminate intermediate div --> | 21 | <!-- TODO: eliminate intermediate div --> |
22 | <div> | 22 | <div> |
23 | <ld-error v-if="checkType(null)" icon="folder-open" :message="$t('gallery.unknown-resource')" /> | 23 | <ld-error v-if="checkType(null)" icon="folder-open" :message="$t('gallery.unknown-resource')" /> |
24 | <gallery-search v-else-if="checkType('directory') && query.length > 0" :path="path" /> | 24 | <gallery-search v-else-if="checkType(ItemType.DIRECTORY) && query.length > 0" :path="path" /> |
25 | <gallery-directory v-else-if="checkType('directory')" :directory="$galleryStore.currentItem" /> | 25 | <gallery-directory |
26 | <ld-picture v-else-if="checkType('picture')" :picture="$galleryStore.currentItem" /> | 26 | v-else-if="checkType(ItemType.DIRECTORY)" |
27 | <ld-plain-text-viewer v-else-if="checkType('plaintext')" :plain-text-item="$galleryStore.currentItem" /> | 27 | :directory="$galleryStore.currentItem" |
28 | <ld-pdf-viewer v-else-if="checkType('pdf')" :pdf-item="$galleryStore.currentItem" /> | 28 | /> |
29 | <ld-video-viewer v-else-if="checkType('video')" :video-item="$galleryStore.currentItem" /> | 29 | <ld-picture v-else-if="checkType(ItemType.PICTURE)" :picture="$galleryStore.currentItem" /> |
30 | <ld-audio-viewer v-else-if="checkType('audio')" :audio-item="$galleryStore.currentItem" /> | 30 | <ld-plain-text-viewer |
31 | v-else-if="checkType(ItemType.PLAINTEXT)" | ||
32 | :plain-text-item="$galleryStore.currentItem" | ||
33 | /> | ||
34 | <ld-pdf-viewer v-else-if="checkType(ItemType.PDF)" :pdf-item="$galleryStore.currentItem" /> | ||
35 | <ld-video-viewer v-else-if="checkType(ItemType.VIDEO)" :video-item="$galleryStore.currentItem" /> | ||
36 | <ld-audio-viewer v-else-if="checkType(ItemType.AUDIO)" :audio-item="$galleryStore.currentItem" /> | ||
31 | <ld-download v-else :item="$galleryStore.currentItem" /> | 37 | <ld-download v-else :item="$galleryStore.currentItem" /> |
32 | </div> | 38 | </div> |
33 | </template> | 39 | </template> |
34 | 40 | ||
35 | <script lang="ts"> | 41 | <script lang="ts"> |
36 | import { Component, Vue, Prop, Watch } from "vue-property-decorator"; | 42 | import { Component, Vue, Prop, Watch } from "vue-property-decorator"; |
43 | import { ItemType } from "@/@types/ItemType"; | ||
37 | import Navigation from "@/services/navigation"; | 44 | import Navigation from "@/services/navigation"; |
38 | import GalleryDirectory from "./GalleryDirectory.vue"; | 45 | import GalleryDirectory from "./GalleryDirectory.vue"; |
39 | import GallerySearch from "@/views/GallerySearch.vue"; | 46 | import GallerySearch from "@/views/GallerySearch.vue"; |
@@ -48,6 +55,9 @@ export default class GalleryNavigation extends Vue { | |||
48 | @Prop(String) readonly path!: string; | 55 | @Prop(String) readonly path!: string; |
49 | @Prop(Array) readonly query!: string[]; | 56 | @Prop(Array) readonly query!: string[]; |
50 | 57 | ||
58 | // For the template | ||
59 | readonly ItemType = Object.freeze(ItemType); | ||
60 | |||
51 | mounted() { | 61 | mounted() { |
52 | this.pathChanged(); | 62 | this.pathChanged(); |
53 | } | 63 | } |
@@ -57,7 +67,7 @@ export default class GalleryNavigation extends Vue { | |||
57 | this.$galleryStore.setCurrentPath(this.path); | 67 | this.$galleryStore.setCurrentPath(this.path); |
58 | } | 68 | } |
59 | 69 | ||
60 | checkType(type: Gallery.ItemType | null): boolean { | 70 | checkType(type: ItemType | null): boolean { |
61 | return Navigation.checkType(this.$galleryStore.currentItem, type); | 71 | return Navigation.checkType(this.$galleryStore.currentItem, type); |
62 | } | 72 | } |
63 | } | 73 | } |