diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2015-05-14 17:00:43 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2015-05-20 14:04:10 +0200 |
commit | cae2df274a9ba92a4fc8db0259811c1755c648e6 (patch) | |
tree | bca116600c5eca880307e80c7465174695d4d03d | |
parent | 8d8b56d135ad05fbfee35fb88618ce8c5498fd68 (diff) | |
download | freeipa-cae2df274a9ba92a4fc8db0259811c1755c648e6.tar.gz freeipa-cae2df274a9ba92a4fc8db0259811c1755c648e6.tar.xz freeipa-cae2df274a9ba92a4fc8db0259811c1755c648e6.zip |
webui: allow to hide facet tabs or sidebar
Reviewed-By: David Kupka <dkupka@redhat.com>
Reviewed-By: Thierry Bordaz <tbordaz@redhat.com>
-rw-r--r-- | install/ui/src/freeipa/facet.js | 37 |
1 files changed, 37 insertions, 0 deletions
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 @@ -714,6 +714,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 * * @deprecated Please update title in facet header or it's widget instead. @@ -1178,6 +1195,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 */ that.select_tab = function() { @@ -1453,6 +1479,7 @@ exp.FacetGroupsWidget = declare([], { groups: null, group_els: null, el: null, + visible: true, css_class: 'facet-tabs', group_el_type: '<div/>', 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); } |