chore: Move from NcModal to NcDialog

Signed-off-by: Julius Knorr <jus@bitgrid.net>
This commit is contained in:
Julius Knorr
2024-12-19 14:49:35 +01:00
parent 60b7357ef4
commit 5aeebc1ed8
2 changed files with 10 additions and 31 deletions

View File

@@ -303,7 +303,7 @@ describe('Card', function () {
}) })
}) })
it.only('clone card', () => { it('clone card', () => {
cy.intercept({ method: 'POST', url: '**/apps/deck/**/cards/*/clone' }).as('clone') cy.intercept({ method: 'POST', url: '**/apps/deck/**/cards/*/clone' }).as('clone')
cy.get('.card:contains("Hello world")').should('be.visible').click() cy.get('.card:contains("Hello world")').should('be.visible').click()
cy.get('#app-sidebar-vue') cy.get('#app-sidebar-vue')
@@ -311,7 +311,7 @@ describe('Card', function () {
cy.get('.app-sidebar-header .action-item__menutoggle').click() cy.get('.app-sidebar-header .action-item__menutoggle').click()
cy.get('.v-popper__popper button:contains("Move/copy card")').click() cy.get('.v-popper__popper button:contains("Move/copy card")').click()
cy.get('.modal__content button:contains("Copy card")').click() cy.get('.modal-container button:contains("Copy card")').click()
cy.wait('@clone', { timeout: 7000 }) cy.wait('@clone', { timeout: 7000 })
cy.get('.card:contains("Hello world")').should('have.length', 2) cy.get('.card:contains("Hello world")').should('have.length', 2)
}) })

View File

@@ -3,9 +3,8 @@
- SPDX-License-Identifier: AGPL-3.0-or-later - SPDX-License-Identifier: AGPL-3.0-or-later
--> -->
<template> <template>
<NcModal v-if="modalShow" :title="t('deck', 'Move card to another board')" @close="modalShow = false"> <NcDialog :open.sync="modalShow" :name="t('deck', 'Move/copy card')">
<div class="modal__content"> <div class="modal__content">
<h3>{{ t('deck', 'Move/copy card to another board') }}</h3>
<NcSelect v-model="selectedBoard" <NcSelect v-model="selectedBoard"
:input-label="t('deck', 'Select a board')" :input-label="t('deck', 'Select a board')"
:placeholder="t('deck', 'Select a board')" :placeholder="t('deck', 'Select a board')"
@@ -20,22 +19,20 @@
:options="stacksFromBoard" :options="stacksFromBoard"
:max-height="100" :max-height="100"
label="title" /> label="title" />
</div>
<NcButton :disabled="!isBoardAndStackChoosen" type="primary" @click="moveCard"> <template #actions>
<NcButton :disabled="!isBoardAndStackChoosen" type="secondary" @click="moveCard">
{{ t('deck', 'Move card') }} {{ t('deck', 'Move card') }}
</NcButton> </NcButton>
<NcButton :disabled="!isBoardAndStackChoosen" type="primary" @click="cloneCard"> <NcButton :disabled="!isBoardAndStackChoosen" type="primary" @click="cloneCard">
{{ t('deck', 'Copy card') }} {{ t('deck', 'Copy card') }}
</NcButton> </NcButton>
<NcButton @click="modalShow = false"> </template>
{{ t('deck', 'Cancel') }} </NcDialog>
</NcButton>
</div>
</NcModal>
</template> </template>
<script> <script>
import { NcModal, NcSelect, NcButton } from '@nextcloud/vue' import { NcDialog, NcSelect, NcButton } from '@nextcloud/vue'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { subscribe, unsubscribe } from '@nextcloud/event-bus' import { subscribe, unsubscribe } from '@nextcloud/event-bus'
@@ -43,7 +40,7 @@ import { mapGetters } from 'vuex'
export default { export default {
name: 'CardMoveDialog', name: 'CardMoveDialog',
components: { NcModal, NcSelect, NcButton }, components: { NcDialog, NcSelect, NcButton },
data() { data() {
return { return {
card: null, card: null,
@@ -104,26 +101,8 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.modal__content { .modal__content {
min-width: 250px;
min-height: 120px;
margin: 20px 20px 100px 20px;
h3 {
font-weight: bold;
text-align: center;
}
.select { .select {
margin-bottom: 12px; margin-bottom: 12px;
} }
} }
button{
margin-left: 6px;
}
.modal__content button {
float: right;
margin-top: 50px;
}
</style> </style>