From f32eab627ad34eda119e6697b5d6c4f2cc02f98f Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 20 May 2014 23:55:18 +0000 Subject: [PATCH] js/forms: treat buttons like input-buttons This fixes a few autosubmission-detection woes. --- public/js/icinga/events.js | 3 +-- public/js/icinga/loader.js | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index cfaea02e1..0035fe0e7 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -292,13 +292,12 @@ submitForm: function (event, autosubmit) { var self = event.data.self; var icinga = self.icinga; - // .closest is not required unless subelements to trigger this var $form = $(event.currentTarget).closest('form'); var regex = new RegExp('&', 'g'); var url = $form.attr('action').replace(regex, '&'); // WHY?? var method = $form.attr('method'); - var $button = $('input[type=submit]:focus', $form); + var $button = $('input[type=submit]:focus', $form).add('button[type=submit]:focus', $form); var $target; var data; diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 32a7875d5..ead489be7 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -233,6 +233,10 @@ if (this.exception !== null) { this.exception.remove(); this.exception = null; + } + + // Remove 'impact' class if there was such + if (req.$target.hasClass('impact')) { req.$target.removeClass('impact'); } @@ -345,11 +349,6 @@ this.icinga.ui.setWindowId(windowId); } - // Remove 'impact' class if there was such - if (req.$target.hasClass('impact')) { - req.$target.removeClass('impact'); - } - // Handle search requests, still hardcoded. if (req.url.match(/^\/search/) && req.$target.data('icingaUrl').match(/^\/search/) &&