From 25263e767bca0104979d1d6c7d05de6464edf796 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 26 Mar 2021 16:47:20 +0100 Subject: [PATCH] js: Allow to disable persistence for collapsibles --- public/js/icinga/behavior/collapsible.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/public/js/icinga/behavior/collapsible.js b/public/js/icinga/behavior/collapsible.js index 1aa4c13d3..5332c4933 100644 --- a/public/js/icinga/behavior/collapsible.js +++ b/public/js/icinga/behavior/collapsible.js @@ -61,7 +61,10 @@ $collapsible.addClass('can-collapse'); - if (! _this.state.has(_this.icinga.utils.getCSSPath($collapsible))) { + if ( + $collapsible.is('[data-no-persistence]') + || ! _this.state.has(_this.icinga.utils.getCSSPath($collapsible)) + ) { _this.collapse($collapsible); } } @@ -91,7 +94,7 @@ $collapsible.after($('#collapsible-control-ghost').clone().removeAttr('id')); $collapsible.addClass('can-collapse'); - if (! _this.state.has(collapsiblePath)) { + if ($collapsible.is('[data-no-persistence]') || ! _this.state.has(collapsiblePath)) { _this.collapse($collapsible); } } @@ -140,6 +143,12 @@ if (! $collapsible.length) { _this.icinga.logger.error('[Collapsible] Collapsible control has no associated .collapsible: ', $target); + } else if ($collapsible.is('[data-no-persistence]')) { + if ($collapsible.is('.collapsed')) { + _this.expand($collapsible); + } else { + _this.collapse($collapsible); + } } else { var collapsiblePath = _this.icinga.utils.getCSSPath($collapsible); if (_this.state.has(collapsiblePath)) {