Better JS link target detection, fix a few edge cases

This commit is contained in:
Thomas Gelf 2014-03-20 15:41:36 +00:00
parent e1de4e384a
commit e8a783a44a
2 changed files with 18 additions and 6 deletions

View File

@ -270,19 +270,24 @@
targetId = $el.closest('[data-base-target]').data('baseTarget'); targetId = $el.closest('[data-base-target]').data('baseTarget');
// Simulate _next to prepare migration to dynamic column layout // Simulate _next to prepare migration to dynamic column layout
// YES, there are duplicate lines right now.
if (targetId === '_next') { if (targetId === '_next') {
if ($el.closest('#col2').length) { if ($el.closest('#col2').length) {
this.icinga.ui.moveToLeft(); this.icinga.ui.moveToLeft();
} }
targetId = 'col2'; targetId = 'col2';
} $target = $('#' + targetId);
} else if (targetId === '_self') {
if (targetId === '_main') { $target = $el.closest('.container');
targetId = $target.attr('id');
} else if (targetId === '_main') {
targetId = 'col1'; targetId = 'col1';
$target = $('#' + targetId);
icinga.ui.layout1col(); icinga.ui.layout1col();
} else {
$target = $('#' + targetId);
} }
$target = $('#' + targetId);
} }
// Hardcoded layout switch unless columns are dynamic // Hardcoded layout switch unless columns are dynamic

View File

@ -99,7 +99,7 @@
}, },
cutContainer: function ($col) { cutContainer: function ($col) {
return { var props = {
'elements': $('#' + $col.attr('id') + ' > div').detach(), 'elements': $('#' + $col.attr('id') + ' > div').detach(),
'data': { 'data': {
'data-icinga-url': $col.data('icingaUrl'), 'data-icinga-url': $col.data('icingaUrl'),
@ -108,7 +108,14 @@
'data-icinga-module': $col.data('icingaModule') 'data-icinga-module': $col.data('icingaModule')
}, },
'class': $col.attr('class') 'class': $col.attr('class')
} };
this.icinga.loader.stopPendingRequestsFor($col);
$col.removeData('icingaUrl');
$col.removeData('icingaRefresh');
$col.removeData('lastUpdate');
$col.removeData('icingaModule');
$col.removeAttr('class').attr('class', 'container');
return props;
}, },
pasteContainer: function ($col, backup) { pasteContainer: function ($col, backup) {