From 16d098d808e127b8d27848a06f10b7db1741afcc Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 26 Jul 2022 16:20:41 +0200 Subject: [PATCH 1/5] Add new locales for contribution date. --- frontend/src/locales/de.json | 1 + frontend/src/locales/en.json | 1 + 2 files changed, 2 insertions(+) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 62edd9815..8bf402805 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -41,6 +41,7 @@ "pending": "Eingereicht und wartet auf Bestätigung", "rejected": "abgelehnt" }, + "date": "Beitrag für:", "delete": "Beitrag löschen! Bist du sicher?", "deleted": "Der Beitrag wurde gelöscht! Wird aber sichtbar bleiben.", "formText": { diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 1cbdc5a8a..236eff4d1 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -41,6 +41,7 @@ "pending": "Submitted and waiting for confirmation", "rejected": "deleted" }, + "date": "Contribution for:", "delete": "Delete Contribution! Are you sure?", "deleted": "The contribution has been deleted! But it will remain visible.", "formText": { From 722886fedc616625050047c77f9a3b77f2ec41cc Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 26 Jul 2022 16:27:44 +0200 Subject: [PATCH 2/5] Add contributionDate month & year to list items. --- .../Contributions/ContributionListItem.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index ca766a008..174335c97 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -11,6 +11,13 @@ {{ $t('math.minus') }}
{{ $d(new Date(date), 'short') }}
+
+ {{ $t('contribution.date') }} + + {{ $d(new Date(contributionDate), 'month') }} + {{ $d(new Date(contributionDate), 'year') }} + +
{{ memo }}
Date: Tue, 26 Jul 2022 16:42:13 +0200 Subject: [PATCH 3/5] Test that date is always createdAt --- .../Contributions/ContributionListItem.spec.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionListItem.spec.js b/frontend/src/components/Contributions/ContributionListItem.spec.js index 20f4db959..08523cae4 100644 --- a/frontend/src/components/Contributions/ContributionListItem.spec.js +++ b/frontend/src/components/Contributions/ContributionListItem.spec.js @@ -13,6 +13,7 @@ describe('ContributionListItem', () => { const propsData = { id: 1, + createdAt: '26/07/2022', contributionDate: '07/06/2022', memo: 'Ich habe 10 Stunden die Elbwiesen von Müll befreit.', amount: '200', @@ -85,20 +86,8 @@ describe('ContributionListItem', () => { }) describe('contribution date', () => { - it('is contributionDate by default', () => { - expect(wrapper.vm.date).toBe(wrapper.vm.contributionDate) - }) - - it('is deletedAt when deletedAt is present', async () => { - const now = new Date().toISOString() - await wrapper.setProps({ deletedAt: now }) - expect(wrapper.vm.date).toBe(now) - }) - - it('is confirmedAt at when confirmedAt is present', async () => { - const now = new Date().toISOString() - await wrapper.setProps({ confirmedAt: now }) - expect(wrapper.vm.date).toBe(now) + it('is equal to createdAt', () => { + expect(wrapper.vm.date).toBe(wrapper.vm.createdAt) }) }) From 89b72f90c581a784f0172d42316742a16fc34c21 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 26 Jul 2022 16:57:39 +0200 Subject: [PATCH 4/5] Update frontend/src/components/Contributions/ContributionListItem.spec.js --- .../src/components/Contributions/ContributionListItem.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/Contributions/ContributionListItem.spec.js b/frontend/src/components/Contributions/ContributionListItem.spec.js index 08523cae4..59918e762 100644 --- a/frontend/src/components/Contributions/ContributionListItem.spec.js +++ b/frontend/src/components/Contributions/ContributionListItem.spec.js @@ -85,7 +85,7 @@ describe('ContributionListItem', () => { }) }) - describe('contribution date', () => { + describe('date', () => { it('is equal to createdAt', () => { expect(wrapper.vm.date).toBe(wrapper.vm.createdAt) }) From 96a7f8a2bff284dfc9a9ea239c8fd9d3d4490fd2 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 26 Jul 2022 16:57:53 +0200 Subject: [PATCH 5/5] Update frontend/src/components/Contributions/ContributionListItem.vue --- frontend/src/components/Contributions/ContributionListItem.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index 174335c97..90e98bc4c 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -14,8 +14,7 @@
{{ $t('contribution.date') }} - {{ $d(new Date(contributionDate), 'month') }} - {{ $d(new Date(contributionDate), 'year') }} + {{ $d(new Date(contributionDate), 'monthAndYear') }}
{{ memo }}