mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 14:54:24 +02:00
colllapsibleContainer.js: Rename to collapsible.js
This commit is contained in:
parent
d6f7582df6
commit
0574f44bd9
@ -24,7 +24,7 @@ class JavaScript
|
|||||||
'js/icinga/timezone.js',
|
'js/icinga/timezone.js',
|
||||||
'js/icinga/behavior/application-state.js',
|
'js/icinga/behavior/application-state.js',
|
||||||
'js/icinga/behavior/autofocus.js',
|
'js/icinga/behavior/autofocus.js',
|
||||||
'js/icinga/behavior/collapsibleContainer.js',
|
'js/icinga/behavior/collapsible.js',
|
||||||
'js/icinga/behavior/detach.js',
|
'js/icinga/behavior/detach.js',
|
||||||
'js/icinga/behavior/tooltip.js',
|
'js/icinga/behavior/tooltip.js',
|
||||||
'js/icinga/behavior/sparkline.js',
|
'js/icinga/behavior/sparkline.js',
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
* @param icinga Icinga The current Icinga Object
|
* @param icinga Icinga The current Icinga Object
|
||||||
*/
|
*/
|
||||||
var CollapsibleContainer = function (icinga) {
|
var Collapsible = function (icinga) {
|
||||||
Icinga.EventListener.call(this, icinga);
|
Icinga.EventListener.call(this, icinga);
|
||||||
|
|
||||||
this.on('rendered', '#col2', this.onRendered, this);
|
this.on('rendered', '#col2', this.onRendered, this);
|
||||||
@ -22,14 +22,14 @@
|
|||||||
this.defaultNumOfRows = 2;
|
this.defaultNumOfRows = 2;
|
||||||
this.defaultHeight = 36;
|
this.defaultHeight = 36;
|
||||||
};
|
};
|
||||||
CollapsibleContainer.prototype = new Icinga.EventListener();
|
Collapsible.prototype = new Icinga.EventListener();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes all collapsibles. Triggered on rendering of a container.
|
* Initializes all collapsibles. Triggered on rendering of a container.
|
||||||
*
|
*
|
||||||
* @param event Event The `onRender` event triggered by the rendered container
|
* @param event Event The `onRender` event triggered by the rendered container
|
||||||
*/
|
*/
|
||||||
CollapsibleContainer.prototype.onRendered = function(event) {
|
Collapsible.prototype.onRendered = function(event) {
|
||||||
var _this = event.data.self;
|
var _this = event.data.self;
|
||||||
|
|
||||||
$('.collapsible', event.currentTarget).each(function() {
|
$('.collapsible', event.currentTarget).each(function() {
|
||||||
@ -48,7 +48,7 @@
|
|||||||
*
|
*
|
||||||
* @param event Event The `onClick` event triggered by the clicked collapsible-control element
|
* @param event Event The `onClick` event triggered by the clicked collapsible-control element
|
||||||
*/
|
*/
|
||||||
CollapsibleContainer.prototype.onControlClicked = function(event) {
|
Collapsible.prototype.onControlClicked = function(event) {
|
||||||
var _this = event.data.self;
|
var _this = event.data.self;
|
||||||
var $target = $(event.currentTarget);
|
var $target = $(event.currentTarget);
|
||||||
var $collapsible = $target.prev('.collapsible');
|
var $collapsible = $target.prev('.collapsible');
|
||||||
@ -66,7 +66,7 @@
|
|||||||
*
|
*
|
||||||
* @param $collapsible jQuery The given collapsible container element
|
* @param $collapsible jQuery The given collapsible container element
|
||||||
*/
|
*/
|
||||||
CollapsibleContainer.prototype.updateCollapsedState = function($collapsible) {
|
Collapsible.prototype.updateCollapsedState = function($collapsible) {
|
||||||
var collapsiblePath = this.icinga.utils.getCSSPath($collapsible);
|
var collapsiblePath = this.icinga.utils.getCSSPath($collapsible);
|
||||||
if (typeof this.expandedContainers[collapsiblePath] === 'undefined') {
|
if (typeof this.expandedContainers[collapsiblePath] === 'undefined') {
|
||||||
this.expandedContainers[collapsiblePath] = $collapsible.is('.collapsed');
|
this.expandedContainers[collapsiblePath] = $collapsible.is('.collapsed');
|
||||||
@ -103,7 +103,7 @@
|
|||||||
*
|
*
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
CollapsibleContainer.prototype.getRowSelector = function ($collapsible) {
|
Collapsible.prototype.getRowSelector = function ($collapsible) {
|
||||||
if ($collapsible.is('table')) {
|
if ($collapsible.is('table')) {
|
||||||
return '> tbody > th, > tbody > tr';
|
return '> tbody > th, > tbody > tr';
|
||||||
} else if ($collapsible.is('ul, ol')) {
|
} else if ($collapsible.is('ul, ol')) {
|
||||||
@ -120,7 +120,7 @@
|
|||||||
*
|
*
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
CollapsibleContainer.prototype.canCollapse = function ($collapsible) {
|
Collapsible.prototype.canCollapse = function ($collapsible) {
|
||||||
var rowSelector = this.getRowSelector($collapsible);
|
var rowSelector = this.getRowSelector($collapsible);
|
||||||
if (!! rowSelector) {
|
if (!! rowSelector) {
|
||||||
return $(rowSelector, $collapsible).length > ($collapsible.data('numofrows') || this.defaultNumOfRows);
|
return $(rowSelector, $collapsible).length > ($collapsible.data('numofrows') || this.defaultNumOfRows);
|
||||||
@ -129,6 +129,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Icinga.Behaviors.collapsibleContainer = CollapsibleContainer;
|
Icinga.Behaviors.Collapsible = Collapsible;
|
||||||
|
|
||||||
})(Icinga, jQuery);
|
})(Icinga, jQuery);
|
Loading…
x
Reference in New Issue
Block a user