Use router parameter to trigger card change
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -80,9 +80,8 @@ export default {
|
|||||||
} */
|
} */
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route': 'fetchData',
|
id: 'fetchData',
|
||||||
showArchived() {
|
showArchived() {
|
||||||
|
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ export default {
|
|||||||
DeletedTabSidebar,
|
DeletedTabSidebar,
|
||||||
TimelineTabSidebard
|
TimelineTabSidebard
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
id: {
|
||||||
|
type: Number
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
board: state => state.currentBoard,
|
board: state => state.currentBoard,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<app-sidebar v-if="currentCard != null"
|
<app-sidebar v-if="currentCard !== null && copiedCard !== null"
|
||||||
:actions="toolbarActions"
|
:actions="toolbarActions"
|
||||||
:title="currentCard.title"
|
:title="currentCard.title"
|
||||||
@close="closeSidebar">
|
@close="closeSidebar">
|
||||||
@@ -89,6 +89,11 @@ export default {
|
|||||||
DatetimePicker,
|
DatetimePicker,
|
||||||
markdownEditor
|
markdownEditor
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
id: {
|
||||||
|
type: Number
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
assignedUsers: null,
|
assignedUsers: null,
|
||||||
@@ -101,10 +106,12 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
currentCard: state => state.currentCard,
|
|
||||||
currentBoard: state => state.currentBoard,
|
currentBoard: state => state.currentBoard,
|
||||||
assignableUsers: state => state.assignableUsers
|
assignableUsers: state => state.assignableUsers
|
||||||
}),
|
}),
|
||||||
|
currentCard() {
|
||||||
|
return this.$store.getters.cardById(this.id)
|
||||||
|
},
|
||||||
subtitle() {
|
subtitle() {
|
||||||
let lastModified = this.currentCard.lastModified
|
let lastModified = this.currentCard.lastModified
|
||||||
let createdAt = this.currentCard.createdAt
|
let createdAt = this.currentCard.createdAt
|
||||||
@@ -131,11 +138,15 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
currentCard() {
|
'currentCard': {
|
||||||
|
immediate: true,
|
||||||
|
handler() {
|
||||||
|
console.log(this.currentCard)
|
||||||
this.copiedCard = JSON.parse(JSON.stringify(this.currentCard))
|
this.copiedCard = JSON.parse(JSON.stringify(this.currentCard))
|
||||||
this.allLabels = this.currentCard.labels
|
this.allLabels = this.currentCard.labels
|
||||||
this.assignedUsers = this.currentCard.assignedUsers.map((item) => item.participant)
|
this.assignedUsers = this.currentCard.assignedUsers.map((item) => item.participant)
|
||||||
this.desc = this.currentCard.description
|
this.desc = this.currentCard.description
|
||||||
|
}
|
||||||
},
|
},
|
||||||
desc() {
|
desc() {
|
||||||
this.copiedCard.description = this.desc
|
this.copiedCard.description = this.desc
|
||||||
|
|||||||
@@ -86,15 +86,29 @@ export default new Router({
|
|||||||
components: {
|
components: {
|
||||||
default: Boards,
|
default: Boards,
|
||||||
sidebar: BoardSidebar
|
sidebar: BoardSidebar
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
default: (route) => {
|
||||||
|
return {
|
||||||
|
id: parseInt(route.params.id, 10)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'cards/:cardId',
|
path: 'cards/:cardId',
|
||||||
name: 'card',
|
name: 'card',
|
||||||
components: {
|
components: {
|
||||||
sidebar: CardSidebar
|
sidebar: CardSidebar
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
sidebar: (route) => {
|
||||||
|
return {
|
||||||
|
id: parseInt(route.params.cardId, 10)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user