Rename post type filters computed in mixin

This commit is contained in:
Wolfgang Huß 2023-05-30 13:03:38 +02:00 committed by mahula
parent 6a6abf1a4a
commit feb4051741
3 changed files with 11 additions and 9 deletions

View File

@ -1,5 +1,6 @@
<template>
<filter-menu-section
v-if="noneSetInPostTypeFilter || articleSetInPostTypeFilter"
class="order-by-filter"
:title="$t('filter-menu.creationDate')"
:divider="false"
@ -31,6 +32,7 @@
<script>
import { mapGetters, mapMutations } from 'vuex'
import FilterMenuMixin from '~/mixins/filterMenuMixin.js'
import FilterMenuSection from '~/components/FilterMenu/FilterMenuSection'
import LabeledButton from '~/components/_new/generic/LabeledButton/LabeledButton'
@ -40,9 +42,9 @@ export default {
FilterMenuSection,
LabeledButton,
},
mixins: [FilterMenuMixin],
computed: {
...mapGetters({
filteredPostTypes: 'posts/filteredPostTypes',
orderBy: 'posts/orderBy',
}),
},

View File

@ -9,7 +9,7 @@
<labeled-button
icon="check"
:label="$t('filter-menu.all')"
:filled="noneSet"
:filled="noneSetInPostTypeFilter"
:title="$t('filter-menu.all')"
@click="setUnsetPostTypeFilter('All')"
/>
@ -18,7 +18,7 @@
<labeled-button
icon="book"
:label="$t('filter-menu.article')"
:filled="articleSet"
:filled="articleSetInPostTypeFilter"
:title="$t('filter-menu.article')"
@click="setUnsetPostTypeFilter('Article')"
/>
@ -27,7 +27,7 @@
<labeled-button
icon="calendar"
:label="$t('filter-menu.event')"
:filled="eventSet"
:filled="eventSetInPostTypeFilter"
:title="$t('filter-menu.event')"
@click="setUnsetPostTypeFilter('Event')"
/>
@ -60,7 +60,7 @@ export default {
})
},
setUnsetPostTypeFilter(setPostType) {
if (this.noneSet) {
if (this.noneSetInPostTypeFilter) {
if (setPostType !== 'All') this.toggleFilterPostType(setPostType)
} else {
if (setPostType !== 'All') {

View File

@ -6,13 +6,13 @@ export default {
filteredPostTypes: 'posts/filteredPostTypes',
currentUser: 'auth/user',
}),
noneSet() {
return !this.articleSet && !this.eventSet
noneSetInPostTypeFilter() {
return !this.articleSetInPostTypeFilter && !this.eventSetInPostTypeFilter
},
articleSet() {
articleSetInPostTypeFilter() {
return this.filteredPostTypes.includes('Article')
},
eventSet() {
eventSetInPostTypeFilter() {
return this.filteredPostTypes.includes('Event')
},
},