From acd85eb0975b37c0b26c927e28e524f04e98d340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sun, 23 Dec 2018 21:57:43 +0100 Subject: [PATCH] Rework routing to make sidebar dependent on child routes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/App.vue | 18 +++++++++----- src/components/Controls.vue | 16 ++++++++++++ src/components/board/Board.vue | 3 +-- src/components/board/BoardSidebar.vue | 16 ++++++------ src/router.js | 35 +++++++++++++++++++++++---- 5 files changed, 66 insertions(+), 22 deletions(-) diff --git a/src/App.vue b/src/App.vue index c62fa66d3..922357dea 100644 --- a/src/App.vue +++ b/src/App.vue @@ -22,14 +22,12 @@ @@ -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 { diff --git a/src/components/Controls.vue b/src/components/Controls.vue index 443ac0ea6..a5f0c37b7 100644 --- a/src/components/Controls.vue +++ b/src/components/Controls.vue @@ -35,6 +35,9 @@ {{ board.title }} +
+ +
@@ -52,6 +55,9 @@ export default { methods: { toggleNav() { this.$store.dispatch('toggleNav') + }, + toggleSidebar: function() { + this.$store.dispatch('toggleSidebar') } } } @@ -67,4 +73,14 @@ export default { position: static; } + .board-actions { + flex-grow: 1; + order: 100; + display: flex; + justify-content: flex-end; + } + button.icon-settings { + width: 44px; + } + diff --git a/src/components/board/Board.vue b/src/components/board/Board.vue index 02bdaa39e..55e1161a8 100644 --- a/src/components/board/Board.vue +++ b/src/components/board/Board.vue @@ -24,7 +24,6 @@
- board {{ board.title }}
@@ -104,7 +103,7 @@ export default { board: state => state.currentBoard }), orderedCards() { - //return (stack) => _.orderBy(this.stacks[stack].cards, 'order') + // return (stack) => _.orderBy(this.stacks[stack].cards, 'order') } }, diff --git a/src/components/board/BoardSidebar.vue b/src/components/board/BoardSidebar.vue index f485105eb..4bb4ff9cf 100644 --- a/src/components/board/BoardSidebar.vue +++ b/src/components/board/BoardSidebar.vue @@ -23,9 +23,6 @@