From 8f1dbd357664cb46ed7f128b9c422f0746cc69bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 25 Apr 2019 19:06:34 +0200 Subject: [PATCH] Add board unarchiving and navigation to board sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .../navigation/AppNavigationBoard.vue | 18 ++++++++++++++++-- src/store/main.js | 13 +++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/components/navigation/AppNavigationBoard.vue b/src/components/navigation/AppNavigationBoard.vue index c487291d4..3c62b3b49 100644 --- a/src/components/navigation/AppNavigationBoard.vue +++ b/src/components/navigation/AppNavigationBoard.vue @@ -129,6 +129,16 @@ export default { icon: 'icon-archive', text: t('deck', 'Archive board') }) + } else { + actions.push({ + action: () => { + this.hideMenu() + this.loading = true + this.$store.dispatch('unarchiveBoard', this.board) + }, + icon: 'icon-archive', + text: t('deck', 'Unarchive board') + }) } actions.push({ @@ -149,8 +159,12 @@ export default { }) actions.push({ - action: () => {}, - icon: 'icon-settings', + action: () => { + const route = this.routeTo; + route.name = 'board.details'; + this.$router.push(route) + }, + icon: 'icon-settings-dark', text: t('deck', 'Board details') }) diff --git a/src/store/main.js b/src/store/main.js index 08ab878cc..e276e4326 100644 --- a/src/store/main.js +++ b/src/store/main.js @@ -144,6 +144,19 @@ export default new Vuex.Store({ commit('addBoard', board) }) }, + /** + * @param commit + * @param state + * @param {Board} board + */ + unarchiveBoard({ commit }, board) { + const boardCopy = JSON.parse(JSON.stringify(board)) + boardCopy.archived = false + apiClient.updateBoard(boardCopy) + .then((board) => { + commit('addBoard', board) + }) + }, /** * Updates a board API side. *