js/forms: treat buttons like input-buttons

This fixes a few autosubmission-detection woes.
This commit is contained in:
Thomas Gelf 2014-05-20 23:55:18 +00:00
parent e4180e3e38
commit f32eab627a
2 changed files with 5 additions and 7 deletions
public/js/icinga

@ -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;

@ -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/) &&