From 3eaccfe5da8cc44638946567d54217fe7630e51a Mon Sep 17 00:00:00 2001 From: Leigh Morresi <275001+dgtlmoon@users.noreply.github.com> Date: Sat, 30 Jan 2021 11:22:59 +0100 Subject: [PATCH] Support for comma separated tags --- backend/backend.py | 10 +++++++--- backend/store.py | 8 ++++++-- backend/templates/edit.html | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/backend/backend.py b/backend/backend.py index 3eb8ae7d..0e910ade 100644 --- a/backend/backend.py +++ b/backend/backend.py @@ -85,9 +85,13 @@ def main_page(): sorted_watches = [] for uuid, watch in datastore.data['watching'].items(): if limit_tag != None: - if watch['tag'] == limit_tag: - watch['uuid'] = uuid - sorted_watches.append(watch) + # Support for comma separated list of tags. + for tag_in_watch in watch['tag'].split(','): + tag_in_watch = tag_in_watch.strip() + if tag_in_watch == limit_tag: + watch['uuid'] = uuid + sorted_watches.append(watch) + else: watch['uuid'] = uuid sorted_watches.append(watch) diff --git a/backend/store.py b/backend/store.py index 4130a66a..f33102f5 100644 --- a/backend/store.py +++ b/backend/store.py @@ -69,8 +69,12 @@ class ChangeDetectionStore: def get_all_tags(self): tags=[] for uuid, watch in self.data['watching'].items(): - if not watch['tag'] in tags: - tags.append(watch['tag']) + + # Support for comma separated list of tags. + for tag in watch['tag'].split(','): + tag = tag.strip() + if not tag in tags: + tags.append(tag) return tags diff --git a/backend/templates/edit.html b/backend/templates/edit.html index 54ebaeb4..1effb60b 100644 --- a/backend/templates/edit.html +++ b/backend/templates/edit.html @@ -15,6 +15,7 @@