From 8b5cd48d3c3e9093f089ae85000e32fbbe6f620a Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Tue, 12 Nov 2019 15:33:21 +0100 Subject: [PATCH] Translate success message, guard clause for no Donations --- webapp/components/DonationInfo/DonationInfo.vue | 5 +++-- webapp/locales/de.json | 3 ++- webapp/locales/en.json | 3 ++- webapp/locales/pt.json | 6 ++++++ webapp/pages/admin/donations.vue | 3 ++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/webapp/components/DonationInfo/DonationInfo.vue b/webapp/components/DonationInfo/DonationInfo.vue index 947f4bdbc..c7d42252b 100644 --- a/webapp/components/DonationInfo/DonationInfo.vue +++ b/webapp/components/DonationInfo/DonationInfo.vue @@ -17,7 +17,7 @@ export default { }, data() { return { - goal: 0, + goal: 15000, progress: 0, } }, @@ -39,7 +39,8 @@ export default { query() { return DonationsQuery() }, - result({ data: { Donations } }) { + update({ Donations }) { + if (!Donations[0]) return const { goal, progress } = Donations[0] this.goal = goal this.progress = progress diff --git a/webapp/locales/de.json b/webapp/locales/de.json index e70fd025a..a9cf7ce2c 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -384,7 +384,8 @@ "donations": { "name": "Spendeninfo", "goal": "Monatlich benötigte Spenden", - "progress": "Bereits gesammelte Spenden" + "progress": "Bereits gesammelte Spenden", + "successfulUpdate": "Spenden-Info erfolgreich aktualisiert!" } }, "post": { diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 958025370..15ef63a95 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -385,7 +385,8 @@ "donations": { "name": "Donations info", "goal": "Monthly donations needed", - "progress": "Donations collected so far" + "progress": "Donations collected so far", + "successfulUpdate": "Donations info updated successfully!" } }, "post": { diff --git a/webapp/locales/pt.json b/webapp/locales/pt.json index 900b65f67..76560aba9 100644 --- a/webapp/locales/pt.json +++ b/webapp/locales/pt.json @@ -380,6 +380,12 @@ "name": "Convidar usuários", "title": "Convidar pessoas", "description": "Convites são uma maneira maravilhosa de ter seus amigos em sua rede …" + }, + "donations": { + "name": "Informações sobre Doações", + "goal": "Doações mensais necessárias", + "progress": "Doações arrecadadas até o momento", + "successfulUpdate": "Informações sobre doações atualizadas com sucesso!" } }, "post": { diff --git a/webapp/pages/admin/donations.vue b/webapp/pages/admin/donations.vue index 9ce2eb76f..7f0205be5 100644 --- a/webapp/pages/admin/donations.vue +++ b/webapp/pages/admin/donations.vue @@ -39,7 +39,7 @@ export default { }, }) .then(() => { - this.$toast.success('yay!!') + this.$toast.success(this.$t('admin.donations.successfulUpdate')) }) .catch(error => this.$toast.error(error.message)) }, @@ -50,6 +50,7 @@ export default { return DonationsQuery() }, update({ Donations }) { + if (!Donations[0]) return const { goal, progress } = Donations[0] this.formData = { goal,