diff options
author | Zero~Informatique | 2020-04-03 21:57:19 +0200 |
---|---|---|
committer | Zero~Informatique | 2020-04-03 21:58:53 +0200 |
commit | 09ec37a772802980d68264f2fed040be36e14c82 (patch) | |
tree | 352868703d2a5602e6c8d8e4a842c5e020eed1f3 /viewer/src/components/LdTagInput.vue | |
parent | 577f49ab6e1fd9cd8007804a13dea1471ee2fb1f (diff) | |
download | ldgallery-09ec37a772802980d68264f2fed040be36e14c82.tar.gz |
viewer: tag categories implementation
fixed disambiguation by categories following code review
GitHub: Resolves #29
Diffstat (limited to 'viewer/src/components/LdTagInput.vue')
-rw-r--r-- | viewer/src/components/LdTagInput.vue | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/viewer/src/components/LdTagInput.vue b/viewer/src/components/LdTagInput.vue index bdb07bc..865db96 100644 --- a/viewer/src/components/LdTagInput.vue +++ b/viewer/src/components/LdTagInput.vue | |||
@@ -54,9 +54,16 @@ export default class LdTagInput extends Vue { | |||
54 | return `${option.display} (${option.items.length})`; | 54 | return `${option.display} (${option.items.length})`; |
55 | } | 55 | } |
56 | 56 | ||
57 | filterAlreadyPresent(newSearch: Tag.Search) { | ||
58 | return !this.model.find( | ||
59 | currentSearch => | ||
60 | currentSearch.tag === newSearch.tag && (!currentSearch.parent || currentSearch.parent === newSearch.parent) | ||
61 | ); | ||
62 | } | ||
63 | |||
57 | searchTags(filter: string) { | 64 | searchTags(filter: string) { |
58 | this.filteredTags = IndexFactory.searchTags(this.tagsIndex, filter, false) | 65 | this.filteredTags = IndexFactory.searchTags(this.tagsIndex, filter, false) |
59 | .filter(newSearch => !this.model.find(currentSearch => currentSearch.tag === newSearch.tag)) | 66 | .filter(this.filterAlreadyPresent) |
60 | .sort((a, b) => b.items.length - a.items.length); | 67 | .sort((a, b) => b.items.length - a.items.length); |
61 | } | 68 | } |
62 | 69 | ||