Delete file 'filterMenuMixin.js' and move all from there to the files where it's used

This commit is contained in:
Wolfgang Huß 2023-06-01 20:42:51 +02:00 committed by mahula
parent fb926b7281
commit 576ba65411
5 changed files with 33 additions and 31 deletions

View File

@ -18,7 +18,7 @@
</template> </template>
<script> <script>
import FilterMenuMixin from '~/mixins/filterMenuMixin.js' import { mapGetters } from 'vuex'
import EventsByFilter from './EventsByFilter' import EventsByFilter from './EventsByFilter'
import PostTypeFilter from './PostTypeFilter' import PostTypeFilter from './PostTypeFilter'
import FollowingFilter from './FollowingFilter' import FollowingFilter from './FollowingFilter'
@ -33,12 +33,16 @@ export default {
CategoriesFilter, CategoriesFilter,
PostTypeFilter, PostTypeFilter,
}, },
mixins: [FilterMenuMixin],
data() { data() {
return { return {
categoriesActive: this.$env.CATEGORIES_ACTIVE, categoriesActive: this.$env.CATEGORIES_ACTIVE,
} }
}, },
computed: {
...mapGetters({
eventSetInPostTypeFilter: 'posts/eventSetInPostTypeFilter',
}),
},
} }
</script> </script>

View File

@ -26,7 +26,7 @@
</template> </template>
<script> <script>
import FilterMenuMixin from '~/mixins/filterMenuMixin.js' import { mapGetters, mapMutations } from 'vuex'
import FilterMenuSection from '~/components/FilterMenu/FilterMenuSection' import FilterMenuSection from '~/components/FilterMenu/FilterMenuSection'
import LabeledButton from '~/components/_new/generic/LabeledButton/LabeledButton' import LabeledButton from '~/components/_new/generic/LabeledButton/LabeledButton'
@ -36,8 +36,11 @@ export default {
FilterMenuSection, FilterMenuSection,
LabeledButton, LabeledButton,
}, },
mixins: [FilterMenuMixin],
computed: { computed: {
...mapGetters({
orderedByCreationDate: 'posts/orderedByCreationDate',
orderBy: 'posts/orderBy',
}),
orderedAsc() { orderedAsc() {
return this.orderedByCreationDate ? 'createdAt_asc' : 'eventStart_desc' return this.orderedByCreationDate ? 'createdAt_asc' : 'eventStart_desc'
}, },
@ -51,6 +54,9 @@ export default {
}, },
}, },
methods: { methods: {
...mapMutations({
toggleOrder: 'posts/TOGGLE_ORDER',
}),
buttonLabel(buttonType) { buttonLabel(buttonType) {
switch (buttonType) { switch (buttonType) {
case 'asc': case 'asc':

View File

@ -37,7 +37,7 @@
</template> </template>
<script> <script>
import FilterMenuMixin from '~/mixins/filterMenuMixin.js' import { mapGetters, mapMutations } from 'vuex'
import FilterMenuSection from '~/components/FilterMenu/FilterMenuSection' import FilterMenuSection from '~/components/FilterMenu/FilterMenuSection'
import LabeledButton from '~/components/_new/generic/LabeledButton/LabeledButton' import LabeledButton from '~/components/_new/generic/LabeledButton/LabeledButton'
@ -47,6 +47,17 @@ export default {
FilterMenuSection, FilterMenuSection,
LabeledButton, LabeledButton,
}, },
mixins: [FilterMenuMixin], computed: {
...mapGetters({
noneSetInPostTypeFilter: 'posts/noneSetInPostTypeFilter',
articleSetInPostTypeFilter: 'posts/articleSetInPostTypeFilter',
eventSetInPostTypeFilter: 'posts/eventSetInPostTypeFilter',
}),
},
methods: {
...mapMutations({
toggleSetUnsetPostTypeFilter: 'posts/TOGGLE_SET_UNSET_POST_TYPE_FILTER',
}),
},
} }
</script> </script>

View File

@ -1,23 +0,0 @@
import { mapGetters, mapMutations } from 'vuex'
export default {
computed: {
...mapGetters({
currentUser: 'auth/user',
filteredPostTypes: 'posts/filteredPostTypes',
noneSetInPostTypeFilter: 'posts/noneSetInPostTypeFilter',
articleSetInPostTypeFilter: 'posts/articleSetInPostTypeFilter',
eventSetInPostTypeFilter: 'posts/eventSetInPostTypeFilter',
orderedByCreationDate: 'posts/orderedByCreationDate',
orderBy: 'posts/orderBy',
}),
},
methods: {
...mapMutations({
toggleFilterPostType: 'posts/TOGGLE_POST_TYPE',
toggleUnsetAllPostTypeFilters: 'posts/TOGGLE_UNSET_ALL_POST_TYPES_FILTERS',
toggleSetUnsetPostTypeFilter: 'posts/TOGGLE_SET_UNSET_POST_TYPE_FILTER',
toggleOrder: 'posts/TOGGLE_ORDER',
}),
},
}

View File

@ -138,7 +138,6 @@
<script> <script>
import postListActions from '~/mixins/postListActions' import postListActions from '~/mixins/postListActions'
import FilterMenuMixin from '~/mixins/filterMenuMixin.js'
import mobile from '~/mixins/mobile' import mobile from '~/mixins/mobile'
import DonationInfo from '~/components/DonationInfo/DonationInfo.vue' import DonationInfo from '~/components/DonationInfo/DonationInfo.vue'
import HashtagsFilter from '~/components/HashtagsFilter/HashtagsFilter.vue' import HashtagsFilter from '~/components/HashtagsFilter/HashtagsFilter.vue'
@ -166,7 +165,7 @@ export default {
FilterMenuComponent, FilterMenuComponent,
HeaderButton, HeaderButton,
}, },
mixins: [postListActions, FilterMenuMixin, mobile()], mixins: [postListActions, mobile()],
data() { data() {
const { hashtag = null } = this.$route.query const { hashtag = null } = this.$route.query
return { return {
@ -191,7 +190,10 @@ export default {
computed: { computed: {
...mapGetters({ ...mapGetters({
postsFilter: 'posts/filter', postsFilter: 'posts/filter',
articleSetInPostTypeFilter: 'posts/articleSetInPostTypeFilter',
eventSetInPostTypeFilter: 'posts/eventSetInPostTypeFilter',
eventsEnded: 'posts/eventsEnded', eventsEnded: 'posts/eventsEnded',
orderBy: 'posts/orderBy',
}), }),
filterButtonIcon() { filterButtonIcon() {
return this.showFilter ? 'angle-up' : 'angle-down' return this.showFilter ? 'angle-up' : 'angle-down'
@ -223,6 +225,8 @@ export default {
}, },
methods: { methods: {
...mapMutations({ ...mapMutations({
toggleUnsetAllPostTypeFilters: 'posts/TOGGLE_UNSET_ALL_POST_TYPES_FILTERS',
toggleSetUnsetPostTypeFilter: 'posts/TOGGLE_SET_UNSET_POST_TYPE_FILTER',
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',