collapsible.js: Rename event callbacks

`onExternalCollapse` => `onCollapse`
`onExternalExpansion` => `onExpand`
This commit is contained in:
Johannes Meyer 2019-07-17 12:45:56 +02:00
parent c976eb48c9
commit 5c290e1b68
1 changed files with 7 additions and 8 deletions

View File

@ -26,9 +26,10 @@
Icinga.Storage.BehaviorStorage('collapsible'), Icinga.Storage.BehaviorStorage('collapsible'),
'expanded' 'expanded'
) )
.on('add', this.onExternalExpansion, this) .on('add', this.onExpand, this)
.on('delete', this.onExternalCollapse, this); .on('delete', this.onCollapse, this);
}; };
Collapsible.prototype = new Icinga.EventListener(); Collapsible.prototype = new Icinga.EventListener();
/** /**
@ -87,10 +88,9 @@
/** /**
* A collapsible got expanded in another window, try to apply this here as well * A collapsible got expanded in another window, try to apply this here as well
* *
* @param {Event} event
* @param {string} collapsiblePath * @param {string} collapsiblePath
*/ */
Collapsible.prototype.onExternalExpansion = function(collapsiblePath) { Collapsible.prototype.onExpand = function(collapsiblePath) {
var $collapsible = $(collapsiblePath); var $collapsible = $(collapsiblePath);
if ($collapsible.length && $collapsible.is('.can-collapse')) { if ($collapsible.length && $collapsible.is('.can-collapse')) {
@ -101,10 +101,9 @@
/** /**
* A collapsible got collapsed in another window, try to apply this here as well * A collapsible got collapsed in another window, try to apply this here as well
* *
* @param {Event} event
* @param {string} collapsiblePath * @param {string} collapsiblePath
*/ */
Collapsible.prototype.onExternalCollapse = function(collapsiblePath) { Collapsible.prototype.onCollapse = function(collapsiblePath) {
var $collapsible = $(collapsiblePath); var $collapsible = $(collapsiblePath);
if ($collapsible.length && this.canCollapse($collapsible)) { if ($collapsible.length && this.canCollapse($collapsible)) {
@ -165,8 +164,8 @@
if (!! rowSelector) { if (!! rowSelector) {
return $(rowSelector, $collapsible).length > ($collapsible.data('visibleRows') || this.defaultVisibleRows); return $(rowSelector, $collapsible).length > ($collapsible.data('visibleRows') || this.defaultVisibleRows);
} else { } else {
var actualHeight = $collapsible[0].scrollHeight, var actualHeight = $collapsible[0].scrollHeight;
maxHeight = $collapsible.data('visibleHeight') || this.defaultVisibleHeight; var maxHeight = $collapsible.data('visibleHeight') || this.defaultVisibleHeight;
if (actualHeight <= maxHeight) { if (actualHeight <= maxHeight) {
return false; return false;