feat: Add possibility to clone cards when cloning a board

Signed-off-by: Max Bachhuber <max.bachhuber@bahuma.io>

Adjust BoardServiceTest to new dependencies

Signed-off-by: Max Bachhuber <max.bachhuber@bahuma.io>

Add BoardCloneModal vue component to frontend. Adjust BoardApi and store to support clone options

Signed-off-by: Max Bachhuber <max.bachhuber@bahuma.io>

Add license and credits

Signed-off-by: Max Bachhuber <max.bachhuber@bahuma.io>

Fix PHP code style

Signed-off-by: Max Bachhuber <max.bachhuber@bahuma.io>

Change default clone settings

Signed-off-by: Max Bachhuber <max.bachhuber@bahuma.io>

Add accordion for advanced settings

Signed-off-by: Max Bachhuber <max.bachhuber@bahuma.io>

Fix bug which caused board to be cloned when clicking out of the modal

Signed-off-by: Max Bachhuber <max.bachhuber@bahuma.io>

Change wording of clone options

Signed-off-by: Max Bachhuber <max.bachhuber@bahuma.io>

fix: Rebase failures

Signed-off-by: Julius Härtl <jus@bitgrid.net>

update cloneBoards phpdoc

make error message clear

SPDX Header BoardCloneModal.vue

Signed-off-by: grnd-alt <salimbelakkaf@outlook.de>
This commit is contained in:
Max Bachhuber
2021-11-16 01:35:09 +01:00
committed by Julius Knorr
parent bdaf28eef4
commit f2c30afe8a
12 changed files with 406 additions and 108 deletions

View File

@@ -12,7 +12,10 @@
:force-display-actions="isTouchDevice"
@click="onNavigate"
@undo="unDelete">
<NcAppNavigationIconBullet slot="icon" :color="board.color" />
<template #icon>
<NcAppNavigationIconBullet :color="board.color" />
<BoardCloneModal v-if="cloneModalOpen" :board-title="board.title" @close="onCloseCloneModal" />
</template>
<template #counter>
<AccountIcon v-if="board.acl.length > 0" />
@@ -33,7 +36,7 @@
</NcActionButton>
<NcActionButton v-if="canCreate && !board.archived"
:close-after-click="true"
@click="actionClone">
@click="showCloneModal">
<template #icon>
<CloneIcon :size="20" decorative />
</template>
@@ -157,6 +160,7 @@ import { loadState } from '@nextcloud/initial-state'
import { emit } from '@nextcloud/event-bus'
import isTouchDevice from '../../mixins/isTouchDevice.js'
import BoardCloneModal from './BoardCloneModal.vue'
const canCreateState = loadState('deck', 'canCreate')
@@ -174,6 +178,7 @@ export default {
CloneIcon,
CloseIcon,
CheckIcon,
BoardCloneModal,
},
directives: {
ClickOutside,
@@ -201,6 +206,7 @@ export default {
isDueSubmenuActive: false,
updateDueSetting: null,
canCreate: canCreateState,
cloneModalOpen: false,
}
},
computed: {
@@ -349,6 +355,26 @@ export default {
})
}
},
showCloneModal() {
this.cloneModalOpen = true
},
async onCloseCloneModal(data) {
this.cloneModalOpen = false
if (data) {
this.loading = true
try {
const newBoard = await this.$store.dispatch('cloneBoard', {
boardData: this.board,
settings: data,
})
this.loading = false
this.$router.push({ name: 'board', params: { id: newBoard.id } })
} catch (e) {
OC.Notification.showTemporary(t('deck', 'An error occurred'))
console.error(e)
}
}
},
},
}
</script>