aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/components/LdTagInput.vue
diff options
context:
space:
mode:
authorOzoneGrif2020-04-04 02:36:03 +0200
committerGitHub2020-04-04 02:36:03 +0200
commitc26ab69997d1d552fda72b8fd88d5910fc91b779 (patch)
treeaea8a7801c1445e71d966ca3a0532200abf2c724 /viewer/src/components/LdTagInput.vue
parent332b208d3fdc91d29181c8f42ef5ff9b1fd1f09a (diff)
parent84090e0f534cfa8bf601ae6df21e5df695fd149a (diff)
downloadldgallery-c26ab69997d1d552fda72b8fd88d5910fc91b779.tar.gz
Merge pull request #172 from pacien/tag-categories
Feature: tag categories
Diffstat (limited to 'viewer/src/components/LdTagInput.vue')
-rw-r--r--viewer/src/components/LdTagInput.vue9
1 files changed, 8 insertions, 1 deletions
diff --git a/viewer/src/components/LdTagInput.vue b/viewer/src/components/LdTagInput.vue
index b1b9e3e..6b6e749 100644
--- a/viewer/src/components/LdTagInput.vue
+++ b/viewer/src/components/LdTagInput.vue
@@ -57,10 +57,17 @@ export default class LdTagInput extends Vue {
57 return `${option.display} (${option.items.length})`; 57 return `${option.display} (${option.items.length})`;
58 } 58 }
59 59
60 filterAlreadyPresent(newSearch: Tag.Search) {
61 return !this.model.find(
62 currentSearch =>
63 currentSearch.tag === newSearch.tag && (!currentSearch.parent || currentSearch.parent === newSearch.parent)
64 );
65 }
66
60 searchTags(filter: string) { 67 searchTags(filter: string) {
61 this.currentFilter = filter; 68 this.currentFilter = filter;
62 this.filteredTags = IndexFactory.searchTags(this.tagsIndex, filter, false) 69 this.filteredTags = IndexFactory.searchTags(this.tagsIndex, filter, false)
63 .filter(newSearch => !this.model.find(currentSearch => currentSearch.tag === newSearch.tag)) 70 .filter(this.filterAlreadyPresent)
64 .sort((a, b) => b.items.length - a.items.length); 71 .sort((a, b) => b.items.length - a.items.length);
65 } 72 }
66 73