From af0717d7afb73c4bc460def1782f29feafaf7a15 Mon Sep 17 00:00:00 2001 From: Robert Goldmann <deadlocker@gmx.de> Date: Sun, 12 Apr 2020 16:00:33 +0200 Subject: [PATCH] #338 - warn about form errors when trying to save a transaction as template --- src/main/resources/languages/_de.properties | 1 + src/main/resources/languages/_en.properties | 1 + src/main/resources/static/js/templates.js | 2 +- .../resources/templates/transactions/newTransactionNormal.ftl | 4 ++++ .../templates/transactions/newTransactionTransfer.ftl | 4 ++++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/resources/languages/_de.properties b/src/main/resources/languages/_de.properties index 6e011620e..7c0ae71a9 100644 --- a/src/main/resources/languages/_de.properties +++ b/src/main/resources/languages/_de.properties @@ -66,6 +66,7 @@ placeholder=Keine Daten verfügbar placeholder.seems.empty=Ganz schön leer hier... placeholder.advice=Füge {0} hinzu save.as.template=Vorlage erzeugen +save.as.template.errorsInForm=Vorlage konnte nicht erstellt werden, da Fehler im Formular existieren! # WEEK DAYS monday=Montag diff --git a/src/main/resources/languages/_en.properties b/src/main/resources/languages/_en.properties index 8c37f0d70..bfc2fa389 100644 --- a/src/main/resources/languages/_en.properties +++ b/src/main/resources/languages/_en.properties @@ -66,6 +66,7 @@ placeholder=No data available placeholder.seems.empty=It''s pretty empty here... placeholder.advice=Get started by adding {0} save.as.template=Create template +save.as.template.errorsInForm=Template could not be created because errors exist in the form! # WEEK DAYS monday=Monday diff --git a/src/main/resources/static/js/templates.js b/src/main/resources/static/js/templates.js index 577d71b24..a8e102d87 100644 --- a/src/main/resources/static/js/templates.js +++ b/src/main/resources/static/js/templates.js @@ -13,7 +13,7 @@ $(document).ready(function() if(!isValidForm) { $('#modalCreateFromTransaction').modal('close'); - // TODO: toast + M.toast({html: createTemplateWithErrorInForm}); return; } diff --git a/src/main/resources/templates/transactions/newTransactionNormal.ftl b/src/main/resources/templates/transactions/newTransactionNormal.ftl index a3b3e1143..c1e0d8da5 100644 --- a/src/main/resources/templates/transactions/newTransactionNormal.ftl +++ b/src/main/resources/templates/transactions/newTransactionNormal.ftl @@ -70,6 +70,10 @@ <#import "../helpers/globalDatePicker.ftl" as datePicker> <@datePicker.datePickerLocalization/> + <script> + createTemplateWithErrorInForm = '${locale.getString("save.as.template.errorsInForm")}'; + </script> + <!-- Scripts--> <#import "../helpers/scripts.ftl" as scripts> <@scripts.scripts/> diff --git a/src/main/resources/templates/transactions/newTransactionTransfer.ftl b/src/main/resources/templates/transactions/newTransactionTransfer.ftl index 2bf38f536..0181e8fca 100644 --- a/src/main/resources/templates/transactions/newTransactionTransfer.ftl +++ b/src/main/resources/templates/transactions/newTransactionTransfer.ftl @@ -75,6 +75,10 @@ <#import "../helpers/globalDatePicker.ftl" as datePicker> <@datePicker.datePickerLocalization/> + <script> + createTemplateWithErrorInForm = '${locale.getString("save.as.template.errorsInForm")}'; + </script> + <!-- Scripts--> <#import "../helpers/scripts.ftl" as scripts> <@scripts.scripts/> -- GitLab