mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
filter menu in content page
This commit is contained in:
parent
bb30d883b9
commit
b9067d7996
@ -11,15 +11,7 @@
|
|||||||
<base-icon class="dropdown-arrow" name="angle-down" />
|
<base-icon class="dropdown-arrow" name="angle-down" />
|
||||||
</base-button>
|
</base-button>
|
||||||
<template slot="popover">
|
<template slot="popover">
|
||||||
<div class="filter-menu-options">
|
<filter-menu-component :showMobileMenu="showMobileMenu" />
|
||||||
<h2 class="title">{{ $t('filter-menu.filter-by') }}</h2>
|
|
||||||
<following-filter />
|
|
||||||
<categories-filter v-if="categoriesActive" :showMobileMenu="showMobileMenu" />
|
|
||||||
</div>
|
|
||||||
<div class="filter-menu-options">
|
|
||||||
<h2 class="title">{{ $t('filter-menu.order-by') }}</h2>
|
|
||||||
<order-by-filter />
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</dropdown>
|
</dropdown>
|
||||||
</template>
|
</template>
|
||||||
@ -27,21 +19,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import Dropdown from '~/components/Dropdown'
|
import Dropdown from '~/components/Dropdown'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import FollowingFilter from './FollowingFilter'
|
import FilterMenuComponent from './FilterMenuComponent'
|
||||||
import OrderByFilter from './OrderByFilter'
|
|
||||||
import CategoriesFilter from './CategoriesFilter'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Dropdown,
|
Dropdown,
|
||||||
FollowingFilter,
|
FilterMenuComponent,
|
||||||
OrderByFilter,
|
|
||||||
CategoriesFilter,
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
categoriesActive: this.$env.CATEGORIES_ACTIVE,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
placement: { type: String },
|
placement: { type: String },
|
||||||
@ -55,14 +38,3 @@ export default {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.filter-menu-options {
|
|
||||||
max-width: $size-max-width-filter-menu;
|
|
||||||
padding: $space-small $space-x-small;
|
|
||||||
|
|
||||||
> .title {
|
|
||||||
font-size: $font-size-large;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
46
webapp/components/FilterMenu/FilterMenuComponent.vue
Normal file
46
webapp/components/FilterMenu/FilterMenuComponent.vue
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="filter-menu-options">
|
||||||
|
<h2 class="title">{{ $t('filter-menu.filter-by') }}</h2>
|
||||||
|
<following-filter />
|
||||||
|
<categories-filter v-if="categoriesActive" :showMobileMenu="showMobileMenu" />
|
||||||
|
</div>
|
||||||
|
<div class="filter-menu-options">
|
||||||
|
<h2 class="title">{{ $t('filter-menu.order-by') }}</h2>
|
||||||
|
<order-by-filter />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import FollowingFilter from './FollowingFilter'
|
||||||
|
import OrderByFilter from './OrderByFilter'
|
||||||
|
import CategoriesFilter from './CategoriesFilter'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
FollowingFilter,
|
||||||
|
OrderByFilter,
|
||||||
|
CategoriesFilter,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
categoriesActive: this.$env.CATEGORIES_ACTIVE,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
showMobileMenu: { type: Boolean, default: false },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.filter-menu-options {
|
||||||
|
max-width: $size-max-width-filter-menu;
|
||||||
|
padding: $space-small $space-x-small;
|
||||||
|
|
||||||
|
> .title {
|
||||||
|
font-size: $font-size-large;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -5,7 +5,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<ds-container>
|
<ds-container>
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
<nuxt />
|
<nuxt :showMobileMenu="showMobileMenu" />
|
||||||
</div>
|
</div>
|
||||||
</ds-container>
|
</ds-container>
|
||||||
<page-footer v-if="!showMobileMenu" />
|
<page-footer v-if="!showMobileMenu" />
|
||||||
|
|||||||
@ -4,6 +4,39 @@
|
|||||||
<ds-grid-item v-if="hashtag" :row-span="2" column-span="fullWidth">
|
<ds-grid-item v-if="hashtag" :row-span="2" column-span="fullWidth">
|
||||||
<hashtags-filter :hashtag="hashtag" @clearSearch="clearSearch" />
|
<hashtags-filter :hashtag="hashtag" @clearSearch="clearSearch" />
|
||||||
</ds-grid-item>
|
</ds-grid-item>
|
||||||
|
<!--Filter Button-->
|
||||||
|
|
||||||
|
<ds-grid-item
|
||||||
|
v-if="categoriesActive"
|
||||||
|
:row-span="1"
|
||||||
|
column-span="fullWidth"
|
||||||
|
style="z-index: 1"
|
||||||
|
>
|
||||||
|
<span v-if="Object.keys(postsFilter).length !== 0">
|
||||||
|
<ds-chip
|
||||||
|
v-for="filter in postsFilter.categories_some.id_in"
|
||||||
|
@remove="removeFilter"
|
||||||
|
removable
|
||||||
|
:key="filter"
|
||||||
|
color="inverse"
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
{{ filter }}
|
||||||
|
</ds-chip>
|
||||||
|
</span>
|
||||||
|
<ds-button :icon="filterButtonIcon" right @click="showFilter = !showFilter">
|
||||||
|
{{ filterButtonText }}
|
||||||
|
</ds-button>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style="background-color: white; box-shadow: rgb(189 189 189) 1px 9px 15px 1px"
|
||||||
|
v-if="showFilter"
|
||||||
|
>
|
||||||
|
<filter-menu-component :showMobileMenu="showMobileMenu" />
|
||||||
|
</div>
|
||||||
|
</ds-grid-item>
|
||||||
|
<ds-space :margin-bottom="{ base: 'small', md: 'base', lg: 'large' }" />
|
||||||
|
|
||||||
<!-- donation info -->
|
<!-- donation info -->
|
||||||
<ds-grid-item v-if="showDonations" class="top-info-bar" :row-span="1" column-span="fullWidth">
|
<ds-grid-item v-if="showDonations" class="top-info-bar" :row-span="1" column-span="fullWidth">
|
||||||
<donation-info :goal="goal" :progress="progress" />
|
<donation-info :goal="goal" :progress="progress" />
|
||||||
@ -65,7 +98,7 @@ import { mapGetters, mapMutations } from 'vuex'
|
|||||||
import { DonationsQuery } from '~/graphql/Donations'
|
import { DonationsQuery } from '~/graphql/Donations'
|
||||||
import { filterPosts } from '~/graphql/PostQuery.js'
|
import { filterPosts } from '~/graphql/PostQuery.js'
|
||||||
import UpdateQuery from '~/components/utils/UpdateQuery'
|
import UpdateQuery from '~/components/utils/UpdateQuery'
|
||||||
|
import FilterMenuComponent from '~/components/FilterMenu/FilterMenuComponent'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
DonationInfo,
|
DonationInfo,
|
||||||
@ -74,11 +107,16 @@ export default {
|
|||||||
HcEmpty,
|
HcEmpty,
|
||||||
MasonryGrid,
|
MasonryGrid,
|
||||||
MasonryGridItem,
|
MasonryGridItem,
|
||||||
|
FilterMenuComponent,
|
||||||
},
|
},
|
||||||
mixins: [postListActions],
|
mixins: [postListActions],
|
||||||
|
props: {
|
||||||
|
showMobileMenu: { type: Boolean, default: false },
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
const { hashtag = null } = this.$route.query
|
const { hashtag = null } = this.$route.query
|
||||||
return {
|
return {
|
||||||
|
showFilter: false,
|
||||||
showDonations: true,
|
showDonations: true,
|
||||||
goal: 15000,
|
goal: 15000,
|
||||||
progress: 7000,
|
progress: 7000,
|
||||||
@ -88,6 +126,7 @@ export default {
|
|||||||
offset: 0,
|
offset: 0,
|
||||||
pageSize: 12,
|
pageSize: 12,
|
||||||
hashtag,
|
hashtag,
|
||||||
|
categoriesActive: this.$env.CATEGORIES_ACTIVE,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -95,6 +134,16 @@ export default {
|
|||||||
postsFilter: 'posts/filter',
|
postsFilter: 'posts/filter',
|
||||||
orderBy: 'posts/orderBy',
|
orderBy: 'posts/orderBy',
|
||||||
}),
|
}),
|
||||||
|
filterButtonIcon() {
|
||||||
|
if (Object.keys(this.postsFilter).length === 0) {
|
||||||
|
return this.showFilter ? 'angle-down' : 'angle-up'
|
||||||
|
}
|
||||||
|
return 'filter'
|
||||||
|
},
|
||||||
|
filterButtonText() {
|
||||||
|
if (this.postsFilter.author) return 'Beiträge von Freunden filtern'
|
||||||
|
return 'Beiträge filtern'
|
||||||
|
},
|
||||||
finalFilters() {
|
finalFilters() {
|
||||||
let filter = this.postsFilter
|
let filter = this.postsFilter
|
||||||
if (this.hashtag) {
|
if (this.hashtag) {
|
||||||
@ -124,6 +173,9 @@ export default {
|
|||||||
resetCategories: 'posts/RESET_CATEGORIES',
|
resetCategories: 'posts/RESET_CATEGORIES',
|
||||||
toggleCategory: 'posts/TOGGLE_CATEGORY',
|
toggleCategory: 'posts/TOGGLE_CATEGORY',
|
||||||
}),
|
}),
|
||||||
|
removeFilter() {
|
||||||
|
alert('Filter löschen')
|
||||||
|
},
|
||||||
clearSearch() {
|
clearSearch() {
|
||||||
this.$router.push({ path: '/' })
|
this.$router.push({ path: '/' })
|
||||||
this.hashtag = null
|
this.hashtag = null
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user