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