From cae2df274a9ba92a4fc8db0259811c1755c648e6 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 14 May 2015 17:00:43 +0200 Subject: webui: allow to hide facet tabs or sidebar Reviewed-By: David Kupka Reviewed-By: Thierry Bordaz --- install/ui/src/freeipa/facet.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'install/ui') diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js index ee09da532..2106e1a35 100644 --- a/install/ui/src/freeipa/facet.js +++ b/install/ui/src/freeipa/facet.js @@ -713,6 +713,23 @@ exp.facet = IPA.facet = function(spec, no_init) { } }; + /** + * Display or hide facet tabs - either in sidebar or facet header + * @param {boolean} visible + */ + that.set_tabs_visible = function(visible) { + + if (that.disable_facet_tabs) return; + if (that.tabs_in_sidebar && that.sidebar_el) { + var a = visible ? exp.sidebar_content_width : exp.sidebar_content_full_width; + var r = visible ? exp.sidebar_content_full_width : exp.sidebar_content_width; + that.sidebar_content_el.removeClass(r); + that.sidebar_content_el.addClass(a); + that.sidebar_el.css('display', visible ? '' : 'none'); + } + that.header.set_tabs_visible(visible); + }; + /** * Update h1 element in title container * @@ -1177,6 +1194,15 @@ exp.facet_header = IPA.facet_header = function(spec) { } }; + /** + * Display or hide facet tabs + * @param {boolean} visible + */ + that.set_tabs_visible = function(visible) { + if (!this.tabs_widget) return; + this.tabs_widget.set_visible(visible); + }; + /** * Select tab with the same name as related facet or default */ @@ -1453,6 +1479,7 @@ exp.FacetGroupsWidget = declare([], { groups: null, group_els: null, el: null, + visible: true, css_class: 'facet-tabs', group_el_type: '
', group_class: 'facet-group', @@ -1582,6 +1609,16 @@ exp.FacetGroupsWidget = declare([], { first.parent().addClass(this.selected_class); }, + set_visible: function(visible) { + this.visible = visible; + this._apply_visible(); + }, + + _apply_visible: function() { + if (!this.el) return; + this.el.css('display', this.visible ? '' : 'none'); + }, + constructor: function(spec) { lang.mixin(this, spec); } -- cgit