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

View File

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

View File

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