From 61fcba812b3237477c7ad3d446f37bc30fed168f Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 13 Nov 2024 11:26:35 +0100 Subject: [PATCH] imp: Add submit feedback on autosubmit forms --- .../javascripts/controllers/autosubmit_controller.js | 8 ++++++++ src/views/_layouts/not_connected.phtml | 1 + src/views/collections/images/edit.phtml | 1 + src/views/importations/opml/show.phtml | 1 + src/views/links/searches/show.phtml | 6 +++++- src/views/my/profile/edit.phtml | 1 + src/views/onboarding/step1.phtml | 1 + 7 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/assets/javascripts/controllers/autosubmit_controller.js b/src/assets/javascripts/controllers/autosubmit_controller.js index 409a62e2c..ed2cc3fc5 100644 --- a/src/assets/javascripts/controllers/autosubmit_controller.js +++ b/src/assets/javascripts/controllers/autosubmit_controller.js @@ -6,6 +6,10 @@ export default class extends Controller { timeout: Number, }; + static get targets () { + return ['actionButton']; + } + connect () { if (this.modeValue === 'timeout') { let timeout; @@ -23,5 +27,9 @@ export default class extends Controller { submit () { this.element.submit(); + + if (this.hasActionButtonTarget) { + this.actionButtonTarget.disabled = true; + } } }; diff --git a/src/views/_layouts/not_connected.phtml b/src/views/_layouts/not_connected.phtml index 08ddfb292..41e15d377 100644 --- a/src/views/_layouts/not_connected.phtml +++ b/src/views/_layouts/not_connected.phtml @@ -115,6 +115,7 @@ id="locale" name="locale" data-action="autosubmit#submit" + data-autosubmit-target="actionButton" > $locale_name): ?>