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');
// Simulate _next to prepare migration to dynamic column layout
// YES, there are duplicate lines right now.
if (targetId === '_next') {
if ($el.closest('#col2').length) {
this.icinga.ui.moveToLeft();
}
targetId = 'col2';
}
if (targetId === '_main') {
$target = $('#' + targetId);
} else if (targetId === '_self') {
$target = $el.closest('.container');
targetId = $target.attr('id');
} else if (targetId === '_main') {
targetId = 'col1';
$target = $('#' + targetId);
icinga.ui.layout1col();
} else {
$target = $('#' + targetId);
}
$target = $('#' + targetId);
}
// Hardcoded layout switch unless columns are dynamic

View File

@ -99,7 +99,7 @@
},
cutContainer: function ($col) {
return {
var props = {
'elements': $('#' + $col.attr('id') + ' > div').detach(),
'data': {
'data-icinga-url': $col.data('icingaUrl'),
@ -108,7 +108,14 @@
'data-icinga-module': $col.data('icingaModule')
},
'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) {