Shorten tree-specific event handler

This commit is contained in:
Thomas Gelf 2014-03-17 16:17:10 +00:00
parent ebbd4119c2
commit a8cecfa162
1 changed files with 6 additions and 18 deletions

View File

@ -94,12 +94,18 @@
$(document).on('mouseenter', '.historycolorgrid td', this.historycolorgridHover);
$(document).on('mouseleave', '.historycolorgrid td', this.historycolorgidUnhover);
$(document).on('click', '.tree .handle', { self: this }, this.treeNodeToggle);
// TBD: a global autocompletion handler
// $(document).on('keyup', 'form.auto input', this.formChangeDelayed);
// $(document).on('change', 'form.auto input', this.formChanged);
// $(document).on('change', 'form.auto select', this.submitForm);
},
treeNodeToggle: function (event) {
$(this).closest('li').toggleClass('collapsed');
},
onUnload: function (event) {
var icinga = event.data.self.icinga;
icinga.logger.info('Unloading Icinga');
@ -198,24 +204,6 @@
$target = self.getLinkTargetFor($a);
// Tree handler
// TODO: We should move this somewhere else and "register" such
// handlers
if ($a.closest('.tree').length) {
$li = $a.closest('li');
if ($li.find('li').length) {
if ($li.hasClass('collapsed')) {
$li.removeClass('collapsed');
} else {
$li.addClass('collapsed');
$li.find('li').addClass('collapsed');
}
return false;
} else {
$target = $('#col2');
}
}
// Load link URL
icinga.loader.loadUrl(href, $target);