change route after board duplication
Signed-off-by: Jakob <jakob.roehrl@web.de>
This commit is contained in:
@@ -153,7 +153,7 @@ class BoardController extends ApiController {
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @param $boardId
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
* @return \OCP\Deck\DB\Board
|
||||
*/
|
||||
public function clone($boardId) {
|
||||
return $this->boardService->clone($boardId);
|
||||
|
||||
@@ -624,7 +624,7 @@ class BoardService {
|
||||
|
||||
$board = $this->boardMapper->find($id);
|
||||
$newBoard = new Board();
|
||||
$newBoard->setTitle($board->getTitle() . ' (copy)');
|
||||
$newBoard->setTitle($board->getTitle() . ' (' . $this->l10n->t('copy') . ')');
|
||||
$newBoard->setOwner($board->getOwner());
|
||||
$newBoard->setColor($board->getColor());
|
||||
$this->boardMapper->insert($newBoard);
|
||||
|
||||
@@ -131,16 +131,20 @@ export default {
|
||||
})
|
||||
|
||||
actions.push({
|
||||
action: () => {
|
||||
action: async () => {
|
||||
this.hideMenu()
|
||||
this.loading = true
|
||||
this.$store.dispatch('cloneBoard', this.board).then((newBoard) => {
|
||||
this.loading = false
|
||||
this.editTitle = this.board.title
|
||||
this.editColor = '#' + this.board.color
|
||||
this.editing = true
|
||||
try {
|
||||
const newBoard = await this.$store.dispatch('cloneBoard', this.board)
|
||||
|
||||
})
|
||||
this.loading = false
|
||||
const route = this.routeTo
|
||||
route.params.id = newBoard.id
|
||||
this.$router.push(route)
|
||||
}
|
||||
catch {
|
||||
OC.Notification.showTemporary(t('deck', 'An error occurred'))
|
||||
}
|
||||
},
|
||||
icon: 'icon-clone',
|
||||
text: t('deck', 'Clone board')
|
||||
|
||||
@@ -281,9 +281,15 @@ export default new Vuex.Store({
|
||||
})
|
||||
},
|
||||
cloneBoard({ commit }, boardData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
apiClient.cloneBoard(boardData)
|
||||
.then((board) => {
|
||||
commit('cloneBoard', board)
|
||||
resolve(board)
|
||||
})
|
||||
.catch((err) => {
|
||||
return reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
removeBoard({ commit }, board) {
|
||||
|
||||
Reference in New Issue
Block a user