From 0fa21004d51a59e05b81471e983ff1be4d68b63f Mon Sep 17 00:00:00 2001 From: Michael Bauer <michael-bauer@posteo.de> Date: Fri, 11 Apr 2025 16:08:44 +0200 Subject: [PATCH 1/2] Fix dialog-Object-Form's internal dialog-mode-handling and move to proper places. Now the dialog-mode can be set from parent via v-model and from child via #activator. The later was previously broken. The new placement just makes more sense with the mixins. --- .../generic/dialogs/DialogObjectForm.vue | 21 ++++------------- .../core/frontend/mixins/objectFormMixin.js | 1 - .../frontend/mixins/openableDialogMixin.js | 23 ++++++++++++++++++- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/aleksis/core/frontend/components/generic/dialogs/DialogObjectForm.vue b/aleksis/core/frontend/components/generic/dialogs/DialogObjectForm.vue index ad23fb520..e8342300f 100644 --- a/aleksis/core/frontend/components/generic/dialogs/DialogObjectForm.vue +++ b/aleksis/core/frontend/components/generic/dialogs/DialogObjectForm.vue @@ -1,6 +1,6 @@ <template> <mobile-fullscreen-dialog - v-model="dialog" + v-model="dialogMode" max-width="500px" :close-button="false" > @@ -26,7 +26,7 @@ :valid.sync="valid" @loading="handleLoading" @save="handleSave" - @cancel="dialog = false" + @cancel="dialogMode = false" > <template v-for="(_, slot) of $scopedSlots" #[slot]="scope" ><slot :name="slot" v-bind="scope" @@ -35,7 +35,7 @@ </template> <template #actions> - <cancel-button @click="dialog = false" :disabled="loading" /> + <cancel-button @click="dialogMode = false" :disabled="loading" /> <save-button @click="$refs.form.submit()" :loading="loading" @@ -67,22 +67,9 @@ export default { }, mixins: [openableDialogMixin, objectFormPropsMixin, loadingMixin], emits: ["cancel", "save"], - computed: { - dialog: { - get() { - return this.value; - }, - set(newValue) { - this.$emit("input", newValue); - }, - }, - }, methods: { - close() { - this.dialog = false; - }, handleSave(items) { - this.dialog = false; + this.dialogMode = false; this.$emit("save", items); }, }, diff --git a/aleksis/core/frontend/mixins/objectFormMixin.js b/aleksis/core/frontend/mixins/objectFormMixin.js index ffc62d476..6797590d2 100644 --- a/aleksis/core/frontend/mixins/objectFormMixin.js +++ b/aleksis/core/frontend/mixins/objectFormMixin.js @@ -47,7 +47,6 @@ export default { this.$emit("cancel"); }, handleSuccess() { - this.dialog = false; let snackbarTextKey = this.isCreate ? this.createSuccessMessageI18nKey : this.editSuccessMessageI18nKey; diff --git a/aleksis/core/frontend/mixins/openableDialogMixin.js b/aleksis/core/frontend/mixins/openableDialogMixin.js index d96f62f58..901e7f814 100644 --- a/aleksis/core/frontend/mixins/openableDialogMixin.js +++ b/aleksis/core/frontend/mixins/openableDialogMixin.js @@ -1,7 +1,7 @@ export default { props: { /** - * Dialog state (open or closed) + * Dialog-mode (open or closed) * @model * @values true,false */ @@ -11,4 +11,25 @@ export default { }, }, emits: ["input"], + data() { + return { + internalDialogMode: this.value, + }; + }, + computed: { + dialogMode: { + get() { + return this.internalDialogMode; + }, + set(newValue) { + this.internalDialogMode = newValue; + this.$emit("input", newValue); + }, + }, + }, + mounted() { + this.$watch("value", (newVal) => { + this.dialogMode = newVal; + }); + }, }; -- GitLab From 00db3b3020b88fb2bf8ce2783915548719a6adae Mon Sep 17 00:00:00 2001 From: Michael Bauer <michael-bauer@posteo.de> Date: Sat, 12 Apr 2025 16:00:51 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index da41b23b5..ee1e1a4dd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -25,6 +25,7 @@ Fixed * The configured theme colors were not used by the frontend. * Recurring events without until value weren't shown. * It wasn't possible to change icons of OAuth applications in the frontend. +* [Dev] Dialog-Object-Form's internal dialog-mode-handling did not implement opening via activator slot. `4.0`_ - 2025-03-29 ------------------- -- GitLab