get things working

This commit is contained in:
Moriz Wahl 2023-06-02 17:46:00 +02:00
parent 73f62212f8
commit 2ae6c350e1
3 changed files with 15 additions and 6 deletions

View File

@ -15,7 +15,7 @@
<labeled-button <labeled-button
icon="calendar" icon="calendar"
:label="$t('filter-menu.ended.onlyEnded.label')" :label="$t('filter-menu.ended.onlyEnded.label')"
:filled="!!eventsEnded" :filled="eventsEnded"
:title="$t('filter-menu.ended.onlyEnded.hint')" :title="$t('filter-menu.ended.onlyEnded.hint')"
@click="toggleEventsEnded" @click="toggleEventsEnded"
data-test="not-ended-button" data-test="not-ended-button"
@ -38,12 +38,15 @@ export default {
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
eventsEnded: 'posts/eventsEnded', postFilter: 'posts/filter',
}), }),
sectionTitle() { sectionTitle() {
// return $t('filter-menu.eventsEnded') // return $t('filter-menu.eventsEnded')
return null return null
}, },
eventsEnded() {
return !!this.postFilter.eventStart_gte
},
}, },
methods: { methods: {
...mapMutations({ ...mapMutations({

View File

@ -44,7 +44,7 @@
:title="$t('contribution.filterMasonryGrid.onlyArticles')" :title="$t('contribution.filterMasonryGrid.onlyArticles')"
:clickButton="openFilterMenu" :clickButton="openFilterMenu"
:titleRemove="$t('filter-menu.deleteFilter')" :titleRemove="$t('filter-menu.deleteFilter')"
:clickRemove="togglePostType(null)" :clickRemove="resetPostType"
/> />
<header-button <header-button
@ -52,7 +52,7 @@
:title="$t('contribution.filterMasonryGrid.onlyEvents')" :title="$t('contribution.filterMasonryGrid.onlyEvents')"
:clickButton="openFilterMenu" :clickButton="openFilterMenu"
:titleRemove="$t('filter-menu.deleteFilter')" :titleRemove="$t('filter-menu.deleteFilter')"
:clickRemove="togglePostType(null)" :clickRemove="resetPostType"
/> />
<header-button <header-button
@ -221,7 +221,7 @@ export default {
}, },
methods: { methods: {
...mapMutations({ ...mapMutations({
togglePostType: 'posts/TOGGLE_TYPE', resetPostType: 'posts/RESET_POST_TYPE',
resetByFollowed: 'posts/TOGGLE_FILTER_BY_FOLLOWED', resetByFollowed: 'posts/TOGGLE_FILTER_BY_FOLLOWED',
resetByGroups: 'posts/TOGGLE_FILTER_BY_MY_GROUPS', resetByGroups: 'posts/TOGGLE_FILTER_BY_MY_GROUPS',
resetCategories: 'posts/RESET_CATEGORIES', resetCategories: 'posts/RESET_CATEGORIES',

View File

@ -18,7 +18,6 @@ export const state = () => {
...defaultFilter, ...defaultFilter,
}, },
order: 'createdAt_desc', order: 'createdAt_desc',
eventsEnded: null,
} }
} }
@ -166,6 +165,13 @@ export const mutations = {
delete filter.language_in delete filter.language_in
state.filter = filter state.filter = filter
}, },
RESET_POST_TYPE(state) {
const filter = clone(state.filter)
delete filter.eventStart_gte
delete filter.postType_in
state.order = 'createdAt_desc'
state.filter = filter
},
TOGGLE_CATEGORY(state, categoryId) { TOGGLE_CATEGORY(state, categoryId) {
const filter = clone(state.filter) const filter = clone(state.filter)
update(filter, 'categories_some.id_in', (categoryIds) => xor(categoryIds, [categoryId])) update(filter, 'categories_some.id_in', (categoryIds) => xor(categoryIds, [categoryId]))