diff options
author | OzoneGrif | 2020-02-27 18:36:06 +0100 |
---|---|---|
committer | GitHub | 2020-02-27 18:36:06 +0100 |
commit | 5c88a08ee28ea37054144c336b14e55ab957f844 (patch) | |
tree | eec84231d3c4fbe470e93b98333238f212ba7b27 /viewer/src/views | |
parent | 3e27a3cfa35359f6ffa83843aa2f2ad53f42f1d4 (diff) | |
parent | 4641f35baebd618ec51fa549adf64670c31c647f (diff) | |
download | ldgallery-5c88a08ee28ea37054144c336b14e55ab957f844.tar.gz |
Merge pull request #163 from pacien/oz-result-count-in-other-folders
viewer: added a count of results found in other folders when no-resul…
Diffstat (limited to 'viewer/src/views')
-rw-r--r-- | viewer/src/views/GallerySearch.vue | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/viewer/src/views/GallerySearch.vue b/viewer/src/views/GallerySearch.vue index 4b6dd7f..9f2ac17 100644 --- a/viewer/src/views/GallerySearch.vue +++ b/viewer/src/views/GallerySearch.vue | |||
@@ -18,7 +18,7 @@ | |||
18 | --> | 18 | --> |
19 | 19 | ||
20 | <template> | 20 | <template> |
21 | <ld-gallery :items="items()" :noresult="$t('search.no-results')" /> | 21 | <ld-gallery :items="items()" :noresult="noResult()" /> |
22 | </template> | 22 | </template> |
23 | 23 | ||
24 | <script lang="ts"> | 24 | <script lang="ts"> |
@@ -30,6 +30,8 @@ import IndexSearch from "@/services/indexsearch"; | |||
30 | export default class GalleryPicture extends Vue { | 30 | export default class GalleryPicture extends Vue { |
31 | @Prop(String) readonly path!: string; | 31 | @Prop(String) readonly path!: string; |
32 | 32 | ||
33 | otherCount: Number = 0; | ||
34 | |||
33 | mounted() { | 35 | mounted() { |
34 | this.$uiStore.fullscreen = false; | 36 | this.$uiStore.fullscreen = false; |
35 | this.$uiStore.searchMode = true; | 37 | this.$uiStore.searchMode = true; |
@@ -40,7 +42,14 @@ export default class GalleryPicture extends Vue { | |||
40 | } | 42 | } |
41 | 43 | ||
42 | items() { | 44 | items() { |
43 | return IndexSearch.search(this.$galleryStore.currentSearch, this.path); | 45 | const searchResult = IndexSearch.search(this.$galleryStore.currentSearch); |
46 | const filteredByPath = searchResult.filter(item => item.path.startsWith(this.path)); | ||
47 | this.otherCount = searchResult.length - filteredByPath.length; | ||
48 | return filteredByPath; | ||
49 | } | ||
50 | |||
51 | noResult() { | ||
52 | return `${this.$t("search.no-results")} • ${this.otherCount} ${this.$t("search.no-results.otherfolders")}`; | ||
44 | } | 53 | } |
45 | } | 54 | } |
46 | </script> | 55 | </script> |