From 703956c3da8c2d333b34bd08bd8d98de98ed64db Mon Sep 17 00:00:00 2001 From: raviks789 <33730024+raviks789@users.noreply.github.com> Date: Tue, 9 Nov 2021 16:21:35 +0100 Subject: [PATCH] Fix unresponsive modal submit buttons in Safari --- public/js/icinga/behavior/modal.js | 11 ++++++++++- public/js/icinga/events.js | 8 ++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/public/js/icinga/behavior/modal.js b/public/js/icinga/behavior/modal.js index 68f895561..90869389a 100644 --- a/public/js/icinga/behavior/modal.js +++ b/public/js/icinga/behavior/modal.js @@ -96,7 +96,16 @@ var $form = $(event.currentTarget).closest('form'); var $modal = $form.closest('#modal'); - var req = _this.icinga.loader.submitForm($form, $autoSubmittedBy); + var $button; + var $rememberedSubmittButton = $form.data('submitButton'); + if (typeof $rememberedSubmittButton != 'undefined') { + if ($form.has($rememberedSubmittButton)) { + $button = $rememberedSubmittButton; + } + $form.removeData('submitButton'); + } + + var req = _this.icinga.loader.submitForm($form, $autoSubmittedBy, $button); req.addToHistory = false; req.$redirectTarget = $modal.data('redirectTarget'); req.done(function (data, textStatus, req) { diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index befab0794..186a41c7c 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -195,6 +195,10 @@ // .closest is not required unless subelements to trigger this var $form = $(event.currentTarget).closest('form'); + if ($form.closest('[data-no-icinga-ajax]').length > 0) { + return true; + } + var $button; var $rememberedSubmittButton = $form.data('submitButton'); if (typeof $rememberedSubmittButton != 'undefined') { @@ -204,10 +208,6 @@ $form.removeData('submitButton'); } - if ($form.closest('[data-no-icinga-ajax]').length > 0) { - return true; - } - if (typeof $button === 'undefined') { var $el;