Skip to content

Commit

Permalink
feat: Add cloning functionality to archived forms in frontend
Browse files Browse the repository at this point in the history
This enables the clone button for archived forms and emits the neccessary events to Forms.vue

Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
  • Loading branch information
Chartman123 committed Jan 14, 2025
1 parent 7732133 commit bf0fc08
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Forms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@
</template>

<!-- Archived forms modal -->
<ArchivedFormsModal :open.sync="showArchivedForms" :forms="archivedForms" />
<ArchivedFormsModal
:open.sync="showArchivedForms"
:forms="archivedForms"
@clone="onCloneForm" />
</NcContent>
</template>

Expand Down
3 changes: 2 additions & 1 deletion src/components/AppNavigationForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
{{ t('forms', 'Results') }}
</NcActionRouter>
<NcActionButton
v-if="canEdit && !isArchived"
v-if="canEdit"
:close-after-click="true"
@click="onCloneForm">
<template #icon>
Expand Down Expand Up @@ -278,6 +278,7 @@ export default {
onShareForm() {
this.$emit('open-sharing', this.form.hash)
},

onCloneForm() {
this.$emit('clone', this.form.id)
},
Expand Down
6 changes: 6 additions & 0 deletions src/components/ArchivedFormsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
:form="form"
:read-only="false"
force-display-actions
@clone="onCloneForm(form.id)"
@delete="onDelete(form)"
@mobile-close-navigation="$emit('update:open', false)" />
</ul>
Expand Down Expand Up @@ -69,6 +70,11 @@ export default defineComponent({
methods: {
t,

onCloneForm(formId) {
this.$emit('clone', formId)
this.$emit('update:open', false)
},

onDelete(form) {
this.shownForms = this.shownForms.filter(({ id }) => id !== form.id)
},
Expand Down

0 comments on commit bf0fc08

Please sign in to comment.