Rework routing to make sidebar dependent on child routes

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-12-23 21:57:43 +01:00
parent ef06f21d2a
commit acd85eb097
5 changed files with 66 additions and 22 deletions

View File

@@ -22,14 +22,12 @@
<template>
<div id="content" v-bind:class="{ 'nav-hidden': !navShown, 'sidebar-hidden': !sidebarShown }">
<div id="content" :class="{ 'nav-hidden': !navShown, 'sidebar-hidden': !sidebarRouterView }">
<DeckAppNav />
<div id="app-content">
<router-view />
</div>
<div id="app-sidebar">
<BoardSidebar v-if="currentBoard" :board="currentBoard" />
</div>
<router-view name="sidebar" />
</div>
</template>
@@ -71,9 +69,17 @@ export default {
computed: {
...mapState({
navShown: state => state.navShown,
sidebarShown: state => state.sidebarShown,
sidebarShownState: state => state.sidebarShown,
currentBoard: state => state.currentBoard
})
}),
// TODO: properly handle sidebar showing for route subview and board sidebar
sidebarRouterView() {
console.log(this.$route)
return this.$route.name === 'card' || this.$route.name === 'board.details'
},
sidebarShown() {
return this.sidebarRouterView || this.sidebarShownState
}
},
provide: function() {
return {