This commit is contained in:
Wolfgang Huß 2021-04-12 15:59:44 +02:00
parent 245be52ac8
commit 7888d93a7f
6 changed files with 2 additions and 102 deletions

View File

@ -33,7 +33,7 @@ export default {
data() {
return {
isPopoverOpen: false,
developperNoAutoClosing: true, // Wolle // stops automatic closing of menu for developper purposes: default is 'false'
developperNoAutoClosing: false, // stops automatic closing of menu for developper purposes: default is 'false'
}
},
computed: {

View File

@ -16,7 +16,7 @@
<following-filter />
</div>
<div class="filter-menu-options">
<h2 class="title">{{ $t('filter-menu.order-by') }}</h2> <!-- Wolle -->
<h2 class="title">{{ $t('filter-menu.order-by') }}</h2>
<date-sort-filter />
</div>
</template>

View File

@ -24,23 +24,6 @@ describe('PostIndex', () => {
store = new Vuex.Store({
getters: {
'posts/filter': () => ({}),
// Wolle
// 'posts/orderOptions': () => () => [
// {
// key: 'store.posts.orderBy.oldest.label',
// label: 'store.posts.orderBy.oldest.label',
// icon: 'sort-amount-asc',
// value: 'createdAt_asc',
// },
// {
// key: 'store.posts.orderBy.newest.label',
// label: 'store.posts.orderBy.newest.label',
// icon: 'sort-amount-desc',
// value: 'createdAt_desc',
// },
// ],
// 'posts/selectedOrder': () => () => 'createdAt_desc',
// 'posts/orderIcon': () => 'sort-amount-desc',
'posts/orderBy': () => 'createdAt_desc',
'auth/user': () => {
return { id: 'u23' }
@ -119,11 +102,6 @@ describe('PostIndex', () => {
localVue,
})
})
// Wolle it('calls store when using order by menu', () => {
// wrapper.findAll('li').at(0).trigger('click')
// expect(mutations['posts/SELECT_ORDER']).toHaveBeenCalledWith({}, 'createdAt_asc')
// })
})
})
})

View File

@ -97,7 +97,6 @@ import HcEmpty from '~/components/Empty/Empty'
import PostTeaser from '~/components/PostTeaser/PostTeaser.vue'
import MasonryGrid from '~/components/MasonryGrid/MasonryGrid.vue'
import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem.vue'
// Wolle import { mapGetters, mapMutations } from 'vuex'
import { mapGetters } from 'vuex'
import { filterPosts } from '~/graphql/PostQuery.js'
import UpdateQuery from '~/components/utils/UpdateQuery'
@ -130,24 +129,8 @@ export default {
computed: {
...mapGetters({
postsFilter: 'posts/filter',
// Wolle care for the store !!! orderOptions: 'posts/orderOptions',
orderBy: 'posts/orderBy',
// Wolle selectedOrder: 'posts/selectedOrder',
// Wolle sortingIcon: 'posts/orderIcon',
}),
// Wolle selected: {
// get() {
// return this.selectedOrder(this)
// },
// set({ value }) {
// this.offset = 0
// this.posts = []
// this.selectOrder(value)
// },
// },
// Wolle sortingOptions() {
// return this.orderOptions(this)
// },
finalFilters() {
let filter = this.postsFilter
if (this.hashtag) {
@ -164,9 +147,6 @@ export default {
},
watchQuery: ['hashtag'],
methods: {
// Wolle ...mapMutations({
// selectOrder: 'posts/SELECT_ORDER',
// }),
clearSearch() {
this.$router.push({ path: '/' })
this.hashtag = null

View File

@ -7,25 +7,11 @@ import clone from 'lodash/clone'
const defaultFilter = {}
// Wolle const orderOptions = {
// createdAt_asc: {
// value: 'createdAt_asc',
// key: 'store.posts.orderBy.oldest.label',
// icon: 'sort-amount-asc',
// },
// createdAt_desc: {
// value: 'createdAt_desc',
// key: 'store.posts.orderBy.newest.label',
// icon: 'sort-amount-desc',
// },
// }
export const state = () => {
return {
filter: {
...defaultFilter,
},
// Wolle order: orderOptions.createdAt_desc,
order: 'createdAt_desc',
}
}
@ -78,7 +64,6 @@ export const mutations = {
state.filter = filter
},
TOGGLE_ORDER(state, value) {
// Wolle state.order = orderOptions[value]
state.order = value
},
}
@ -102,24 +87,7 @@ export const getters = {
filteredByEmotions(state) {
return get(state.filter, 'emotions_some.emotion_in') || []
},
// Wolle orderOptions: (state) => ({ $t }) =>
// Object.values(orderOptions).map((option) => {
// return {
// ...option,
// label: $t(option.key),
// }
// }),
// Wolle selectedOrder: (state) => ({ $t }) => {
// return {
// ...state.order,
// label: $t(state.order.key),
// }
// },
orderBy(state) {
// return state.order.value
return state.order
},
// Wolle orderIcon(state) {
// return state.order.icon
// },
}

View File

@ -80,35 +80,9 @@ describe('getters', () => {
})
})
// Wolle describe('orderByOptions', () => {
// it('returns all options regardless of current state', () => {
// const $t = jest.fn((t) => t)
// expect(getters.orderOptions()({ $t })).toEqual([
// {
// key: 'store.posts.orderBy.oldest.label',
// label: 'store.posts.orderBy.oldest.label',
// icon: 'sort-amount-asc',
// value: 'createdAt_asc',
// },
// {
// key: 'store.posts.orderBy.newest.label',
// label: 'store.posts.orderBy.newest.label',
// icon: 'sort-amount-desc',
// value: 'createdAt_desc',
// },
// ])
// })
// })
describe('orderBy', () => {
it('returns value for graphql query', () => {
state = {
// Wolle order: {
// key: 'store.posts.orderBy.newest.label',
// label: 'store.posts.orderBy.newest.label',
// icon: 'sort-amount-desc',
// value: 'createdAt_desc',
// },
order: 'createdAt_desc',
}
expect(getters.orderBy(state)).toEqual('createdAt_desc')