Merge pull request #2527 from gradido/2516-Creation-menu-is-not-highlighted-on-all-submenus

fix(frontend): creation menu highlighted on all submenus
This commit is contained in:
Alexander Friedland 2023-01-13 16:54:34 +01:00 committed by GitHub
commit baeedf80a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 30 deletions

View File

@ -19,7 +19,7 @@
<b-icon icon="layers" aria-hidden="true"></b-icon> <b-icon icon="layers" aria-hidden="true"></b-icon>
<span class="ml-2">{{ $t('gdt.gdt') }}</span> <span class="ml-2">{{ $t('gdt.gdt') }}</span>
</b-nav-item> </b-nav-item>
<b-nav-item to="/community#my" class="" active-class="activeRoute"> <b-nav-item to="/community" class="" active-class="activeRoute">
<b-icon icon="people" aria-hidden="true"></b-icon> <b-icon icon="people" aria-hidden="true"></b-icon>
<span class="ml-2">{{ $t('creation') }}</span> <span class="ml-2">{{ $t('creation') }}</span>
</b-nav-item> </b-nav-item>

View File

@ -1,20 +1,20 @@
<template> <template>
<div class="nav-community"> <div class="nav-community container">
<b-row class="nav-row"> <b-row class="nav-row">
<b-col cols="12" lg="4" md="4"> <b-col cols="12" lg="4" md="4" class="px-0">
<b-btn active-class="btn-active" block variant="link" to="#edit"> <b-btn active-class="btn-active" block variant="link" to="/community#edit">
<b-icon icon="pencil" class="mr-2" /> <b-icon icon="pencil" class="mr-2" />
{{ $t('community.submitContribution') }} {{ $t('community.submitContribution') }}
</b-btn> </b-btn>
</b-col> </b-col>
<b-col cols="12" lg="4" md="4"> <b-col cols="12" lg="4" md="4" class="px-0">
<b-btn active-class="btn-active" block variant="link" to="#my"> <b-btn active-class="btn-active" block variant="link" to="/community#my">
<b-icon icon="person" class="mr-2" /> <b-icon icon="person" class="mr-2" />
{{ $t('community.myContributions') }} {{ $t('community.myContributions') }}
</b-btn> </b-btn>
</b-col> </b-col>
<b-col cols="12" lg="4" md="4"> <b-col cols="12" lg="4" md="4" class="px-0">
<b-btn active-class="btn-active" block variant="link" to="#all"> <b-btn active-class="btn-active" block variant="link" to="/community#all">
<b-icon icon="people" class="mr-2" /> <b-icon icon="people" class="mr-2" />
{{ $t('community.community') }} {{ $t('community.community') }}
</b-btn> </b-btn>

View File

@ -4,33 +4,13 @@ import { toastErrorSpy, toastSuccessSpy } from '@test/testSetup'
import { createContribution, updateContribution, deleteContribution } from '@/graphql/mutations' import { createContribution, updateContribution, deleteContribution } from '@/graphql/mutations'
import { listContributions, listAllContributions } from '@/graphql/queries' import { listContributions, listAllContributions } from '@/graphql/queries'
import VueRouter from 'vue-router'
import routes from '../routes/routes'
const localVue = global.localVue const localVue = global.localVue
localVue.use(VueRouter)
const mockStoreDispach = jest.fn() const mockStoreDispach = jest.fn()
const apolloQueryMock = jest.fn() const apolloQueryMock = jest.fn()
const apolloMutationMock = jest.fn() const apolloMutationMock = jest.fn()
const apolloRefetchMock = jest.fn() const apolloRefetchMock = jest.fn()
const router = new VueRouter({
base: '/',
routes,
linkActiveClass: 'active',
mode: 'history',
// scrollBehavior: (to, from, savedPosition) => {
// if (savedPosition) {
// return savedPosition
// }
// if (to.hash) {
// return { selector: to.hash }
// }
// return { x: 0, y: 0 }
// },
})
describe('Community', () => { describe('Community', () => {
let wrapper let wrapper
@ -55,12 +35,17 @@ describe('Community', () => {
$i18n: { $i18n: {
locale: 'en', locale: 'en',
}, },
$router: {
push: jest.fn(),
},
$route: {
hash: 'my',
},
} }
const Wrapper = () => { const Wrapper = () => {
return mount(Community, { return mount(Community, {
localVue, localVue,
router,
mocks, mocks,
}) })
} }

View File

@ -280,7 +280,7 @@ export default {
if (this.items.find((item) => item.state === 'IN_PROGRESS')) { if (this.items.find((item) => item.state === 'IN_PROGRESS')) {
this.tabIndex = 1 this.tabIndex = 1
if (this.$route.hash !== '#my') { if (this.$route.hash !== '#my') {
this.$router.push({ path: '#my' }) this.$router.push({ path: '/community#my' })
} }
this.toastInfo('Du hast eine Rückfrage auf eine Contribution. Bitte beantworte diese!') this.toastInfo('Du hast eine Rückfrage auf eine Contribution. Bitte beantworte diese!')
} }
@ -318,6 +318,7 @@ export default {
}) })
this.updateTransactions(0) this.updateTransactions(0)
this.tabIndex = 1 this.tabIndex = 1
this.$router.push({ path: '/community#my' })
}, },
} }
</script> </script>