aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/views/GallerySearch.vue
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/views/GallerySearch.vue')
-rw-r--r--viewer/src/views/GallerySearch.vue42
1 files changed, 29 insertions, 13 deletions
diff --git a/viewer/src/views/GallerySearch.vue b/viewer/src/views/GallerySearch.vue
index 7e61f89..e75a37e 100644
--- a/viewer/src/views/GallerySearch.vue
+++ b/viewer/src/views/GallerySearch.vue
@@ -18,25 +18,41 @@
18--> 18-->
19 19
20<template> 20<template>
21 <div class="flex"> 21 <ld-gallery :items="items()" :noresult="noResult()" />
22 <div v-for="(item) in items" :key="item.path">
23 <router-link :to="item.path" @click.native="$uiStore.setModeNavigation()">
24 <gallery-thumbnail :item="item" />
25 </router-link>
26 </div>
27 <div v-if="items.length===0">{{$t('search.no-results')}}</div>
28 </div>
29</template> 22</template>
30 23
31<script lang="ts"> 24<script lang="ts">
32import { Component, Vue, Prop } from "vue-property-decorator"; 25import { Component, Vue, Prop } from "vue-property-decorator";
33import GalleryThumbnail from "./GalleryThumbnail.vue"; 26import { Operation } from "@/@types/Operation";
27import IndexSearch from "@/services/indexsearch";
34 28
35@Component({ 29@Component
36 components: { GalleryThumbnail },
37})
38export default class GalleryPicture extends Vue { 30export default class GalleryPicture extends Vue {
39 @Prop({ required: true }) readonly items!: Gallery.Item[]; 31 @Prop(String) readonly path!: string;
32
33 otherCount: Number = 0;
34
35 mounted() {
36 this.$uiStore.toggleFullscreen(false);
37 this.$uiStore.toggleSearchMode(true);
38 }
39
40 destroyed() {
41 this.$uiStore.toggleSearchMode(false);
42 this.$galleryStore.setCurrentSearch([]);
43 }
44
45 items() {
46 const searchResult = IndexSearch.search(this.$galleryStore.currentSearch);
47 const filteredByPath = searchResult.filter(item => item.path.startsWith(this.path));
48 this.otherCount = searchResult.length - filteredByPath.length;
49 return filteredByPath;
50 }
51
52 noResult() {
53 const params = [this.otherCount, this.otherCount > 1 ? "s" : ""];
54 return this.$t("search.no-results.otherfolders", params);
55 }
40} 56}
41</script> 57</script>
42 58