From f5611fa841d4be123b9bc42681fb0f980d9331aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Fri, 26 May 2023 19:40:14 +0200 Subject: [PATCH] Add 'All' button to filter menu post type buttons - Unset post type filter menu button by clicking a set button. --- .../components/FilterMenu/PostTypeFilter.vue | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/webapp/components/FilterMenu/PostTypeFilter.vue b/webapp/components/FilterMenu/PostTypeFilter.vue index 4fc1205ec..bc6669238 100644 --- a/webapp/components/FilterMenu/PostTypeFilter.vue +++ b/webapp/components/FilterMenu/PostTypeFilter.vue @@ -5,13 +5,22 @@ class="following-filter" > @@ -62,13 +71,20 @@ export default { ...mapMutations({ toggleFilterPostType: 'posts/TOGGLE_POST_TYPE', }), - setPostTypeFilter(setPostType) { + unsetAll() { + this.postTypes.forEach((postType) => { + if (this.filteredPostTypes.includes(postType)) this.toggleFilterPostType(postType) + }) + }, + setUnsetPostTypeFilter(setPostType) { if (this.noneSet) { if (setPostType !== 'All') this.toggleFilterPostType(setPostType) } else { if (setPostType !== 'All') { - // if not set then set and unset all others - if (!this.filteredPostTypes.includes(setPostType)) { + if (this.filteredPostTypes.includes(setPostType)) { + this.unsetAll() + } else { + // if not set then set and unset all others this.toggleFilterPostType(setPostType) this.postTypes.forEach((postType) => { if (postType !== setPostType) @@ -76,10 +92,7 @@ export default { }) } } else { - // unset all - this.postTypes.forEach((postType) => { - if (this.filteredPostTypes.includes(postType)) this.toggleFilterPostType(postType) - }) + this.unsetAll() } } },