From a7d459a2620fa9523dd7ce8c9de519133ad5b1b7 Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Fri, 31 Jan 2020 08:01:23 +0100
Subject: viewer: tag propositions depend on current's directory. resolves #22

---
 viewer/src/components/LdProposition.vue | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'viewer/src/components/LdProposition.vue')

diff --git a/viewer/src/components/LdProposition.vue b/viewer/src/components/LdProposition.vue
index 02f7fe4..a380021 100644
--- a/viewer/src/components/LdProposition.vue
+++ b/viewer/src/components/LdProposition.vue
@@ -56,8 +56,10 @@ export default class LdTagInput extends Vue {
         .filter(rawTag => !currentTags.find(currentTag => currentTag.tag === rawTag))
         .forEach(rawTag => (propositions[rawTag] = (propositions[rawTag] ?? 0) + 1));
     } else {
-      // Tags count from the whole gallery
-      Object.entries(this.$galleryStore.tags).forEach(entry => (propositions[entry[0]] = entry[1].items.length));
+      // Tags count from the current directory
+      this.$galleryStore.currentItem?.tags
+        .map(tag => this.$galleryStore.tags[tag]) // FIXME: Folders with the same name are merged in the index
+        .forEach(tagindex => (propositions[tagindex.tag] = tagindex.items.length));
     }
 
     return Object.entries(propositions)
-- 
cgit v1.2.3

