From ad4597f3be3cf9b6a3e58c8f27659eaa5b7c6841 Mon Sep 17 00:00:00 2001 From: Falk Date: Tue, 19 Dec 2023 13:54:22 +0100 Subject: [PATCH] fix: incorporate review feedback --- .../components/cfb-form-list/copy-modal.hbs | 19 ++++++++++--------- .../components/cfb-form-list/copy-modal.js | 12 ++---------- .../tests/acceptance/form-copy-test.js | 8 ++++---- packages/form-builder/translations/de.yaml | 1 + packages/form-builder/translations/fr.yaml | 10 ++++++++++ 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/packages/form-builder/addon/components/cfb-form-list/copy-modal.hbs b/packages/form-builder/addon/components/cfb-form-list/copy-modal.hbs index db06148b4d..9e4da8abbc 100644 --- a/packages/form-builder/addon/components/cfb-form-list/copy-modal.hbs +++ b/packages/form-builder/addon/components/cfb-form-list/copy-modal.hbs @@ -1,10 +1,10 @@ -{{#if this.visible}} - + + {{#if this.visible}} @@ -43,7 +44,7 @@ - -{{/if}} + {{/if}} + {{yield (hash toggle=this.toggle)}} \ No newline at end of file diff --git a/packages/form-builder/addon/components/cfb-form-list/copy-modal.js b/packages/form-builder/addon/components/cfb-form-list/copy-modal.js index 7bdffd676f..3b3de0180f 100644 --- a/packages/form-builder/addon/components/cfb-form-list/copy-modal.js +++ b/packages/form-builder/addon/components/cfb-form-list/copy-modal.js @@ -49,21 +49,13 @@ export default class componentsCfbFormItemListCopyModal extends Component { ); this.notification.success( - this.intl.t( - `caluma.form-builder.notification.form.${ - this.args.slug ? "save" : "create" - }.success`, - ), + this.intl.t("caluma.form-builder.notification.form.create.success"), ); this.router.transitionTo("edit", form.slug); } catch (e) { this.notification.danger( - this.intl.t( - `caluma.form-builder.notification.form.${ - this.args.slug ? "save" : "create" - }.error`, - ), + this.intl.t("caluma.form-builder.notification.form.create.error"), ); } } diff --git a/packages/form-builder/tests/acceptance/form-copy-test.js b/packages/form-builder/tests/acceptance/form-copy-test.js index 609d02a23b..d98ff37381 100644 --- a/packages/form-builder/tests/acceptance/form-copy-test.js +++ b/packages/form-builder/tests/acceptance/form-copy-test.js @@ -17,17 +17,17 @@ module("Acceptance | form copy", function (hooks) { await visit("/"); - assert.dom("[data-test-copy-form-modal]").isNotVisible(); + assert.dom("[data-test-copy-form-modal] form").isNotVisible(); await click(`[data-test-copy-form-button=${form.slug}]`); - assert.dom("[data-test-copy-form-modal]").isVisible(); + assert.dom("[data-test-copy-form-modal] form").isVisible(); assert.dom("[data-test-copy-modal-input-name]").hasValue(form.name); - assert.dom("[data-test-copy-modal-input-slug]").hasValue(form.slug); + assert.dom("input[name=slug]").hasValue(form.slug); await fillIn("[data-test-copy-modal-input-name]", `${form.name} copy`); - await fillIn("[data-test-copy-modal-input-slug]", `${form.slug}-copy`); + await fillIn("input[name=slug]", `${form.slug}-copy`); await click("[data-test-copy-form-submit]"); diff --git a/packages/form-builder/translations/de.yaml b/packages/form-builder/translations/de.yaml index cefefafbf9..8ec87f2312 100644 --- a/packages/form-builder/translations/de.yaml +++ b/packages/form-builder/translations/de.yaml @@ -179,6 +179,7 @@ caluma: label: "Slug" hint: "Original: {slug}" submit: "Formular kopieren" + validations: form: slug: "Ein Formular mit diesem Slug existiert bereits" diff --git a/packages/form-builder/translations/fr.yaml b/packages/form-builder/translations/fr.yaml index 81fa3630f2..ac79df04fa 100644 --- a/packages/form-builder/translations/fr.yaml +++ b/packages/form-builder/translations/fr.yaml @@ -170,6 +170,16 @@ caluma: success: "Votre question a été enregistrée avec succès !" error: "Oups, quelque chose s'est mal passé lors de l'enregistrement de la question..." + copy-modal: + title: 'Copier "{form}"' + name: + label: "Nom" + hint: "Original : {name}" + slug: + label: "Slug" + hint: "Original : {slug}" + submit: "Copier le formulaire" + validations: form: slug: "Un formulaire avec ce slug existe déjà"