webui: allow to hide facet tabs or sidebar

Reviewed-By: David Kupka <dkupka@redhat.com>
Reviewed-By: Thierry Bordaz <tbordaz@redhat.com>
This commit is contained in:
Petr Vobornik committed 2015-05-20 14:04:10 +02:00
1 parent 8d8b56d135
commit cae2df274a
1 file changed
+37
+37
View File
@@ -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: '<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);
}