aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-01-09 17:48:23 +0100
committerTeddy Wing2018-01-09 17:48:23 +0100
commitf9bc7a661c2fb88aef1662bd60d8d6d8a3cff443 (patch)
tree35d0a493846c833e8e44242bf8f811af19d7e0ae
parent7e152ed43030c939a719be5949b71a5179c3dcd7 (diff)
downloadchouette-core-f9bc7a661c2fb88aef1662bd60d8d6d8a3cff443.tar.bz2
Referentials#new: Disable submit button on submit
To prevent double/duplicate form submissions, disable the submit button after it's clicked. Eventually we'll want to do this for all SimpleForms in the application. Here's a solution for doing that: http://www.railsonmaui.com/blog/2014/02/23/simple-form-and-disable-processing-by-default/ Refs #5524
-rw-r--r--app/views/referentials/_form.html.slim6
-rw-r--r--config/locales/actions.en.yml1
-rw-r--r--config/locales/actions.fr.yml1
3 files changed, 7 insertions, 1 deletions
diff --git a/app/views/referentials/_form.html.slim b/app/views/referentials/_form.html.slim
index 1611ee6dd..9927f05bd 100644
--- a/app/views/referentials/_form.html.slim
+++ b/app/views/referentials/_form.html.slim
@@ -51,4 +51,8 @@
.hidden = form.input :workbench_id, as: :hidden
- = form.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'referential_form'
+ = form.button :submit,
+ t('actions.submit'),
+ class: 'btn btn-default formSubmitr',
+ data: { disable_with: t('actions.processing') },
+ form: 'referential_form'
diff --git a/config/locales/actions.en.yml b/config/locales/actions.en.yml
index f5f48db22..08d505393 100644
--- a/config/locales/actions.en.yml
+++ b/config/locales/actions.en.yml
@@ -7,6 +7,7 @@ en:
delete: "Delete"
search: "Search"
submit: "Submit"
+ processing: "Processing…"
add: "Add new"
new: "Add new"
show: "See"
diff --git a/config/locales/actions.fr.yml b/config/locales/actions.fr.yml
index 4b3ac6901..4690c995a 100644
--- a/config/locales/actions.fr.yml
+++ b/config/locales/actions.fr.yml
@@ -7,6 +7,7 @@ fr:
delete: 'Supprimer'
search: "Chercher"
submit: "Valider"
+ processing: "En cours…"
add: 'Créer'
new: 'Créer'
show: 'Consulter'