clone board func with labels and stacks
Signed-off-by: Jakob <jakob.roehrl@web.de>
This commit is contained in:
@@ -130,6 +130,16 @@ export default {
|
||||
text: t('deck', 'Edit board')
|
||||
})
|
||||
|
||||
actions.push({
|
||||
action: () => {
|
||||
this.hideMenu()
|
||||
// this.boardApi.cloneBoard(this.board)
|
||||
this.$store.dispatch('cloneBoard', this.board)
|
||||
},
|
||||
icon: 'icon-clone',
|
||||
text: t('deck', 'Clone board')
|
||||
})
|
||||
|
||||
if (!this.board.archived) {
|
||||
actions.push({
|
||||
action: () => {
|
||||
|
||||
@@ -135,6 +135,21 @@ export class BoardApi {
|
||||
})
|
||||
}
|
||||
|
||||
cloneBoard(board) {
|
||||
return axios.post(this.url(`/boards/${board.id}/clone`))
|
||||
.then(
|
||||
(response) => {
|
||||
return Promise.resolve(response.data)
|
||||
},
|
||||
(err) => {
|
||||
return Promise.reject(err)
|
||||
}
|
||||
)
|
||||
.catch((err) => {
|
||||
return Promise.reject(err)
|
||||
})
|
||||
}
|
||||
|
||||
// Label API Calls
|
||||
deleteLabel(id) {
|
||||
return axios.delete(this.url(`/labels/${id}`))
|
||||
|
||||
@@ -115,6 +115,19 @@ export default new Vuex.Store({
|
||||
state.boards.push(board)
|
||||
}
|
||||
},
|
||||
|
||||
cloneBoard(state, board) {
|
||||
const indexExisting = state.boards.findIndex((b) => {
|
||||
return board.id === b.id
|
||||
})
|
||||
|
||||
if (indexExisting > -1) {
|
||||
Vue.set(state.boards, indexExisting, board)
|
||||
} else {
|
||||
state.boards.push(board)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes the board from the store.
|
||||
*
|
||||
@@ -267,6 +280,12 @@ export default new Vuex.Store({
|
||||
commit('addBoard', board)
|
||||
})
|
||||
},
|
||||
cloneBoard({ commit }, boardData) {
|
||||
apiClient.cloneBoard(boardData)
|
||||
.then((board) => {
|
||||
commit('cloneBoard', board)
|
||||
})
|
||||
},
|
||||
removeBoard({ commit }, board) {
|
||||
commit('removeBoard', board)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user