mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-20 20:01:25 +00:00
Merge branch '5818-Display-filter-as-buttons-instead-of-filter-menu' into merge-5750-in-5818
This commit is contained in:
commit
69e82145cd
@ -11,15 +11,7 @@
|
||||
<base-icon class="dropdown-arrow" name="angle-down" />
|
||||
</base-button>
|
||||
<template slot="popover">
|
||||
<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>
|
||||
<filter-menu-component :showMobileMenu="showMobileMenu" />
|
||||
</template>
|
||||
</dropdown>
|
||||
</template>
|
||||
@ -27,21 +19,12 @@
|
||||
<script>
|
||||
import Dropdown from '~/components/Dropdown'
|
||||
import { mapGetters } from 'vuex'
|
||||
import FollowingFilter from './FollowingFilter'
|
||||
import OrderByFilter from './OrderByFilter'
|
||||
import CategoriesFilter from './CategoriesFilter'
|
||||
import FilterMenuComponent from './FilterMenuComponent'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Dropdown,
|
||||
FollowingFilter,
|
||||
OrderByFilter,
|
||||
CategoriesFilter,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
categoriesActive: this.$env.CATEGORIES_ACTIVE,
|
||||
}
|
||||
FilterMenuComponent,
|
||||
},
|
||||
props: {
|
||||
placement: { type: String },
|
||||
@ -55,14 +38,3 @@ export default {
|
||||
},
|
||||
}
|
||||
</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>
|
||||
<ds-container>
|
||||
<div class="main-container">
|
||||
<nuxt />
|
||||
<nuxt :showMobileMenu="showMobileMenu" />
|
||||
</div>
|
||||
</ds-container>
|
||||
<page-footer v-if="!showMobileMenu" />
|
||||
|
||||
@ -267,8 +267,12 @@
|
||||
"happy": "Glücklich",
|
||||
"surprised": "Erstaunt"
|
||||
},
|
||||
"filterALL": "Alle Beiträge anzeigen",
|
||||
"filterFollow": "Beiträge von Benutzern filtern, denen ich folge",
|
||||
"filterMasonryGrid": {
|
||||
"myFriends": "Beiträge von meinen Freunden",
|
||||
"myTheme": "Meine Themen",
|
||||
"noFilter": "Beiträge filtern"
|
||||
},
|
||||
"inappropriatePicture": "Dieses Bild kann für einige Menschen unangemessen sein.",
|
||||
"languageSelectLabel": "Sprache Deines Beitrags",
|
||||
"languageSelectText": "Sprache wählen",
|
||||
|
||||
@ -267,8 +267,12 @@
|
||||
"happy": "Happy",
|
||||
"surprised": "Surprised"
|
||||
},
|
||||
"filterALL": "View all contributions",
|
||||
"filterFollow": "Filter contributions from users I follow",
|
||||
"filterMasonryGrid": {
|
||||
"myFriends": "Posts From My Friends",
|
||||
"myTheme": "My Themes",
|
||||
"noFilter": "Filter Posts"
|
||||
},
|
||||
"inappropriatePicture": "This image may be inappropriate for some people.",
|
||||
"languageSelectLabel": "Language of your contribution",
|
||||
"languageSelectText": "Select Language",
|
||||
|
||||
@ -4,6 +4,100 @@
|
||||
<ds-grid-item v-if="hashtag" :row-span="2" column-span="fullWidth">
|
||||
<hashtags-filter :hashtag="hashtag" @clearSearch="clearSearch" />
|
||||
</ds-grid-item>
|
||||
<!--Filter Button-->
|
||||
|
||||
<ds-grid-item
|
||||
v-if="categoriesActive"
|
||||
:row-span="1"
|
||||
column-span="fullWidth"
|
||||
class="filterButtonMenu"
|
||||
>
|
||||
<base-button
|
||||
class="my-filter-button"
|
||||
v-if="!postsFilter['categories_some'] && !postsFilter['author']"
|
||||
right
|
||||
@click="showFilter = !showFilter"
|
||||
filled
|
||||
>
|
||||
{{ $t('contribution.filterMasonryGrid.noFilter') }}
|
||||
|
||||
<base-icon class="my-filter-button" :name="filterButtonIcon"></base-icon>
|
||||
</base-button>
|
||||
<!-- <ds-button
|
||||
class="my-filter-button"
|
||||
v-if="!postsFilter['categories_some'] && !postsFilter['author']"
|
||||
:icon="filterButtonIcon"
|
||||
right
|
||||
@click="showFilter = !showFilter"
|
||||
>
|
||||
{{ $t('contribution.filterMasonryGrid.noFilter') }}
|
||||
</ds-button> -->
|
||||
|
||||
<span v-if="postsFilter['categories_some']">
|
||||
<!-- <ds-button class="my-filter-button" right @click="showFilter = !showFilter">
|
||||
{{ $t('contribution.filterMasonryGrid.myTheme') }}
|
||||
</ds-button> -->
|
||||
<base-button class="my-filter-button" right @click="showFilter = !showFilter" filled>
|
||||
{{ $t('contribution.filterMasonryGrid.myTheme') }}
|
||||
</base-button>
|
||||
<base-button
|
||||
class="filter-remove"
|
||||
@click="resetCategories"
|
||||
icon="close"
|
||||
title="Filter löschen"
|
||||
style="margin-left: -8px"
|
||||
filled
|
||||
/>
|
||||
|
||||
<!-- <ds-button
|
||||
class="filter-remove"
|
||||
@click="resetCategories"
|
||||
icon="close"
|
||||
title="Filter löschen"
|
||||
style="margin-left: -14px"
|
||||
></ds-button> -->
|
||||
</span>
|
||||
|
||||
<span v-if="postsFilter['author']">
|
||||
<base-button class="my-filter-button" right @click="showFilter = !showFilter" filled>
|
||||
{{ $t('contribution.filterMasonryGrid.myFriends') }}
|
||||
</base-button>
|
||||
<base-button
|
||||
class="filter-remove"
|
||||
@click="resetByFollowed"
|
||||
icon="close"
|
||||
title="Filter löschen"
|
||||
style="margin-left: -8px"
|
||||
filled
|
||||
/>
|
||||
|
||||
<!-- <ds-button
|
||||
v-if="postsFilter['author']"
|
||||
class="my-filter-button"
|
||||
right
|
||||
@click="showFilter = !showFilter"
|
||||
>
|
||||
{{ $t('contribution.filterMasonryGrid.myFriends') }}
|
||||
</ds-button>
|
||||
<ds-button
|
||||
class="filter-remove"
|
||||
@click="resetByFollowed"
|
||||
icon="close"
|
||||
title="Filter löschen"
|
||||
style="margin-left: -14px"
|
||||
></ds-button> -->
|
||||
</span>
|
||||
|
||||
<div
|
||||
id="my-filter"
|
||||
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 -->
|
||||
<ds-grid-item v-if="showDonations" class="top-info-bar" :row-span="1" column-span="fullWidth">
|
||||
<donation-info :goal="goal" :progress="progress" />
|
||||
@ -65,7 +159,7 @@ import { mapGetters, mapMutations } from 'vuex'
|
||||
import { DonationsQuery } from '~/graphql/Donations'
|
||||
import { filterPosts } from '~/graphql/PostQuery.js'
|
||||
import UpdateQuery from '~/components/utils/UpdateQuery'
|
||||
|
||||
import FilterMenuComponent from '~/components/FilterMenu/FilterMenuComponent'
|
||||
export default {
|
||||
components: {
|
||||
DonationInfo,
|
||||
@ -74,11 +168,16 @@ export default {
|
||||
HcEmpty,
|
||||
MasonryGrid,
|
||||
MasonryGridItem,
|
||||
FilterMenuComponent,
|
||||
},
|
||||
mixins: [postListActions],
|
||||
props: {
|
||||
showMobileMenu: { type: Boolean, default: false },
|
||||
},
|
||||
data() {
|
||||
const { hashtag = null } = this.$route.query
|
||||
return {
|
||||
showFilter: false,
|
||||
showDonations: true,
|
||||
goal: 15000,
|
||||
progress: 7000,
|
||||
@ -88,6 +187,7 @@ export default {
|
||||
offset: 0,
|
||||
pageSize: 12,
|
||||
hashtag,
|
||||
categoriesActive: this.$env.CATEGORIES_ACTIVE,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -95,6 +195,12 @@ export default {
|
||||
postsFilter: 'posts/filter',
|
||||
orderBy: 'posts/orderBy',
|
||||
}),
|
||||
filterButtonIcon() {
|
||||
if (Object.keys(this.postsFilter).length === 0) {
|
||||
return this.showFilter ? 'angle-up' : 'angle-down'
|
||||
}
|
||||
return 'close'
|
||||
},
|
||||
finalFilters() {
|
||||
let filter = this.postsFilter
|
||||
if (this.hashtag) {
|
||||
@ -118,12 +224,23 @@ export default {
|
||||
this.resetCategories()
|
||||
this.toggleCategory(this.categoryId)
|
||||
}
|
||||
document.addEventListener('click', this.showFilterMenu)
|
||||
},
|
||||
methods: {
|
||||
...mapMutations({
|
||||
resetByFollowed: 'posts/TOGGLE_FILTER_BY_FOLLOWED',
|
||||
resetCategories: 'posts/RESET_CATEGORIES',
|
||||
toggleCategory: 'posts/TOGGLE_CATEGORY',
|
||||
}),
|
||||
showFilterMenu(e) {
|
||||
if (!e.target.closest('#my-filter') && !e.target.closest('.my-filter-button')) {
|
||||
if (!this.showFilter) return
|
||||
this.showFilter = false
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.removeEventListener('click', this.showFilterMenu)
|
||||
},
|
||||
clearSearch() {
|
||||
this.$router.push({ path: '/' })
|
||||
this.hashtag = null
|
||||
@ -225,4 +342,12 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.filterButtonMenu {
|
||||
position: fixed;
|
||||
z-index: 6;
|
||||
margin-top: -35px;
|
||||
padding: 20px 10px 5px 10px;
|
||||
border-radius: 7px;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user