From 106a72dd787419edbae4bf64171cb13f2e45078e Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 9 Nov 2022 14:36:11 +0100 Subject: [PATCH 1/4] better behaviour when editing --- .../ContributionLink/ContributionLink.vue | 18 ++++++++++++++++-- .../ContributionLink/ContributionLinkForm.vue | 5 +++++ admin/src/locales/de.json | 1 + admin/src/locales/en.json | 1 + 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/admin/src/components/ContributionLink/ContributionLink.vue b/admin/src/components/ContributionLink/ContributionLink.vue index a2d171d56..7190742f7 100644 --- a/admin/src/components/ContributionLink/ContributionLink.vue +++ b/admin/src/components/ContributionLink/ContributionLink.vue @@ -8,7 +8,11 @@ header-class="text-center" class="mt-5" > - + {{ $t('math.plus') }} {{ $t('contributionLink.newContributionLink') }} @@ -19,6 +23,7 @@ :contributionLinkData="contributionLinkData" :editContributionLink="editContributionLink" @get-contribution-links="$emit('get-contribution-links')" + @closeContributionForm="closeContributionForm" /> @@ -63,9 +68,18 @@ export default { } }, methods: { + closeContributionForm() { + if (this.visible) { + this.$root.$emit('bv::toggle::collapse', 'newContribution') + this.editContributionLink = false + } + }, editContributionLinkData(data) { - if (!this.visible) this.$root.$emit('bv::toggle::collapse', 'newContribution') + if (!this.visible) { + this.$root.$emit('bv::toggle::collapse', 'newContribution') + } this.contributionLinkData = data + console.log('contributionLinkData', this.contributionLinkData) this.editContributionLink = true }, }, diff --git a/admin/src/components/ContributionLink/ContributionLinkForm.vue b/admin/src/components/ContributionLink/ContributionLinkForm.vue index 05f5dac8b..ff7af8f7d 100644 --- a/admin/src/components/ContributionLink/ContributionLinkForm.vue +++ b/admin/src/components/ContributionLink/ContributionLinkForm.vue @@ -6,6 +6,7 @@ {{ $t('contributionLink.clear') }} + + {{ $t('contributionLink.close') }} + diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index ffe1cab24..c012e3171 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -5,6 +5,7 @@ "amount": "Betrag", "changeSaved": "Änderungen gespeichert", "clear": "Löschen", + "close": "Schließen", "contributionLinks": "Beitragslinks", "create": "Anlegen", "cycle": "Zyklus", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index b32efe97e..9bff733c5 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -5,6 +5,7 @@ "amount": "Amount", "changeSaved": "Changes saved", "clear": "Clear", + "close": "Close", "contributionLinks": "Contribution Links", "create": "Create", "cycle": "Cycle", From ae3a8dc5875920cde061e5917b59384fdde547c7 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 9 Nov 2022 14:37:23 +0100 Subject: [PATCH 2/4] fix lint and locales --- admin/src/components/ContributionLink/ContributionLink.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/admin/src/components/ContributionLink/ContributionLink.vue b/admin/src/components/ContributionLink/ContributionLink.vue index 7190742f7..1bff30226 100644 --- a/admin/src/components/ContributionLink/ContributionLink.vue +++ b/admin/src/components/ContributionLink/ContributionLink.vue @@ -79,7 +79,6 @@ export default { this.$root.$emit('bv::toggle::collapse', 'newContribution') } this.contributionLinkData = data - console.log('contributionLinkData', this.contributionLinkData) this.editContributionLink = true }, }, From 8b9b6f1f9ae152aa3d647efb65c28bbc0482d677 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 9 Nov 2022 17:15:29 +0100 Subject: [PATCH 3/4] fix clean display for all functions --- .../components/ContributionLink/ContributionLink.vue | 1 + .../ContributionLink/ContributionLinkForm.vue | 11 ++--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/admin/src/components/ContributionLink/ContributionLink.vue b/admin/src/components/ContributionLink/ContributionLink.vue index 1bff30226..c8963d3ab 100644 --- a/admin/src/components/ContributionLink/ContributionLink.vue +++ b/admin/src/components/ContributionLink/ContributionLink.vue @@ -72,6 +72,7 @@ export default { if (this.visible) { this.$root.$emit('bv::toggle::collapse', 'newContribution') this.editContributionLink = false + this.contributionLinkData = {} } }, editContributionLinkData(data) { diff --git a/admin/src/components/ContributionLink/ContributionLinkForm.vue b/admin/src/components/ContributionLink/ContributionLinkForm.vue index ff7af8f7d..85b9a3e95 100644 --- a/admin/src/components/ContributionLink/ContributionLinkForm.vue +++ b/admin/src/components/ContributionLink/ContributionLinkForm.vue @@ -112,7 +112,7 @@ {{ $t('contributionLink.clear') }} - + {{ $t('contributionLink.close') }} @@ -208,14 +208,7 @@ export default { }, watch: { contributionLinkData() { - this.form.name = this.contributionLinkData.name - this.form.memo = this.contributionLinkData.memo - this.form.amount = this.contributionLinkData.amount - this.form.validFrom = this.contributionLinkData.validFrom - this.form.validTo = this.contributionLinkData.validTo - this.form.cycle = this.contributionLinkData.cycle - this.form.maxPerCycle = this.contributionLinkData.maxPerCycle - this.form.maxAmountPerMonth = this.contributionLinkData.maxAmountPerMonth + this.form = this.contributionLinkData }, }, } From c8227670a43edd4747ca1dbd0871edda1aa03ad9 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 9 Nov 2022 19:58:47 +0100 Subject: [PATCH 4/4] fix test over 95% --- .../src/components/ContributionLink/ContributionLink.spec.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/admin/src/components/ContributionLink/ContributionLink.spec.js b/admin/src/components/ContributionLink/ContributionLink.spec.js index 9818e8b93..b72a0347c 100644 --- a/admin/src/components/ContributionLink/ContributionLink.spec.js +++ b/admin/src/components/ContributionLink/ContributionLink.spec.js @@ -46,5 +46,10 @@ describe('ContributionLink', () => { wrapper.vm.editContributionLinkData() expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy() }) + + it('emits toggle::collapse close Contribution-Form ', async () => { + wrapper.vm.closeContributionForm() + expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy() + }) }) })