From ce457ffc0c51014292d873a818155c2889a2306c Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 15 Feb 2022 11:11:34 +0100 Subject: [PATCH 01/21] Toaster titles --- 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 fbd9c8e91..ac2b22fc7 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -208,6 +208,7 @@ "title": "Danke!" } }, + "success": "Erfolg", "transaction": { "gdd-text": "Gradido Transaktionen", "gdt-text": "GradidoTransform Transaktionen", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 534aa25e8..a3fbe2ac7 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -208,6 +208,7 @@ "title": "Thank you!" } }, + "success": "Success", "transaction": { "gdd-text": "Gradido Transactions", "gdt-text": "GradidoTransform Transactions", From df63d76a8619ce939a9a2c6ec1c3ae92f7606529 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 15 Feb 2022 11:18:50 +0100 Subject: [PATCH 02/21] global mixin for toasting error and success --- frontend/src/main.js | 3 +++ frontend/src/mixins/toaster.js | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 frontend/src/mixins/toaster.js diff --git a/frontend/src/main.js b/frontend/src/main.js index 0b47a7564..25e417359 100755 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -3,6 +3,7 @@ import DashboardPlugin from './plugins/dashboard-plugin' import App from './App.vue' import i18n from './i18n.js' import { loadAllRules } from './validation-rules' +import { toasters } from './mixins/toaster' import 'regenerator-runtime' @@ -18,6 +19,8 @@ import { apolloProvider } from './plugins/apolloProvider' Vue.use(DashboardPlugin) Vue.config.productionTip = false +Vue.mixin(toasters) + Vue.toasted.register( 'error', (payload) => { diff --git a/frontend/src/mixins/toaster.js b/frontend/src/mixins/toaster.js new file mode 100644 index 000000000..ec1bcfc0a --- /dev/null +++ b/frontend/src/mixins/toaster.js @@ -0,0 +1,24 @@ +export const toasters = { + methods: { + toastSuccess(message) { + this.toast(message, { + title: this.$t('success'), + variant: 'danger', + }) + }, + toastError(message) { + this.toast(message, { + title: this.$t('error.error'), + variant: 'success', + }) + }, + toast(message, options) { + this.$bvToast.toast(message, { + autoHideDelay: 5000, + appendToast: false, + solid: true, + ...options, + }) + }, + }, +} From b9bbcb299821bf5a61864a37dbf7ef44408e6cbb Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 15 Feb 2022 11:52:07 +0100 Subject: [PATCH 03/21] add custom style classes to toaster --- frontend/src/App.vue | 9 +++++++++ frontend/src/mixins/toaster.js | 10 +++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 25b0eadc5..23d637de4 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -41,6 +41,15 @@ export default { }