Move layout functions to ui.js

This commit is contained in:
Thomas Gelf 2014-03-08 15:08:03 +01:00
parent 7e2d6cd5c2
commit 8de42139d3
3 changed files with 25 additions and 25 deletions

View File

@ -158,27 +158,6 @@
return false;
},
layout1col: function () {
if (! $('#layout').hasClass('twocols')) { return; }
var $col2 = $('#col2');
icinga.logger.debug('Switching to single col');
$('#layout').removeClass('twocols');
$col2.removeAttr('data-icinga-url');
$col2.removeAttr('data-icinga-refresh');
$col2.removeData('icingaUrl');
$col2.removeData('icingaRefresh');
this.icinga.loader.stopPendingRequestsFor($col2);
$col2.html('');
this.icinga.ui.fixControls();
},
layout2col: function () {
if ($('#layout').hasClass('twocols')) { return; }
icinga.logger.debug('Switching to double col');
$('#layout').addClass('twocols');
this.icinga.ui.fixControls();
},
/**
* Someone clicked a link or tr[href]
*/
@ -262,12 +241,12 @@
// Menu links should remove all but the first layout column
if (isMenuLink) {
icinga.events.layout1col();
icinga.ui.layout1col();
}
// Hardcoded layout switch unless columns are dynamic
if ($target.attr('id') === 'col2') {
icinga.events.layout2col();
icinga.ui.layout2col();
}
return false;
},

View File

@ -139,11 +139,11 @@
}
// TODO: Replace with dynamic columns
icinga.events.layout2col();
icinga.ui.layout2col();
} else {
// TODO: Replace with dynamic columns
icinga.events.layout1col();
icinga.ui.layout1col();
}
},

View File

@ -134,6 +134,27 @@
return false;
},
layout1col: function () {
if (! $('#layout').hasClass('twocols')) { return; }
var $col2 = $('#col2');
icinga.logger.debug('Switching to single col');
$('#layout').removeClass('twocols');
$col2.removeAttr('data-icinga-url');
$col2.removeAttr('data-icinga-refresh');
$col2.removeData('icingaUrl');
$col2.removeData('icingaRefresh');
this.icinga.loader.stopPendingRequestsFor($col2);
$col2.html('');
this.fixControls();
},
layout2col: function () {
if ($('#layout').hasClass('twocols')) { return; }
icinga.logger.debug('Switching to double col');
$('#layout').addClass('twocols');
this.fixControls();
},
getAvailableColumnSpace: function () {
return $('#main').width() / this.getDefaultFontSize();
},