Skip to content

Commit

Permalink
fix: incorporate review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabauke committed Dec 19, 2023
1 parent 744d2ff commit ad4597f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{#if this.visible}}
<UkModal
@visible={{this.visible}}
@onHide={{fn (mut this.visible) false}}
data-test-copy-form-modal
as |modal|
>
<UkModal
@visible={{this.visible}}
@onHide={{fn (mut this.visible) false}}
data-test-copy-form-modal
as |modal|
>
{{#if this.visible}}
<ValidatedForm
@model={{this.changeset}}
@on-submit={{perform this.submit}}
Expand All @@ -26,6 +26,7 @@
@name="slug"
@label={{t "caluma.form-builder.copy-modal.slug.label"}}
@hint={{t "caluma.form-builder.copy-modal.slug.hint" slug=@item.slug}}
@renderComponent={{component "cfb-slug-input" hidePrefix=false}}
data-test-copy-modal-input-slug
/>
</modal.body>
Expand All @@ -43,7 +44,7 @@
</f.submit>
</modal.footer>
</ValidatedForm>
</UkModal>
{{/if}}
{{/if}}
</UkModal>

{{yield (hash toggle=this.toggle)}}
12 changes: 2 additions & 10 deletions packages/form-builder/addon/components/cfb-form-list/copy-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/form-builder/tests/acceptance/form-copy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]");

Expand Down
1 change: 1 addition & 0 deletions packages/form-builder/translations/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ caluma:
label: "Slug"
hint: "Original: {slug}"
submit: "Formular kopieren"

validations:
form:
slug: "Ein Formular mit diesem Slug existiert bereits"
Expand Down
10 changes: 10 additions & 0 deletions packages/form-builder/translations/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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à"
Expand Down

0 comments on commit ad4597f

Please sign in to comment.