Merge "Allow to hide tab title bar when only one tab is available"

This commit is contained in:
Jenkins 2015-03-07 00:07:56 +00:00 committed by Gerrit Code Review
commit 750ef0b347
2 changed files with 8 additions and 0 deletions

View File

@ -48,6 +48,11 @@ class TabGroup(html.HTMLElement):
across requests for a given user. (State storage is all done across requests for a given user. (State storage is all done
client-side.) client-side.)
.. attribute:: show_single_tab
Boolean to control whether the tab bar is shown when the tab group
has only one tab. Default: ``False``
.. attribute:: param_name .. attribute:: param_name
The name of the GET request parameter which will be used when The name of the GET request parameter which will be used when
@ -77,6 +82,7 @@ class TabGroup(html.HTMLElement):
template_name = "horizon/common/_tab_group.html" template_name = "horizon/common/_tab_group.html"
param_name = 'tab' param_name = 'tab'
sticky = False sticky = False
show_single_tab = False
_selected = None _selected = None
_active = None _active = None

View File

@ -2,6 +2,7 @@
{% if tabs %} {% if tabs %}
{# Tab Navigation #} {# Tab Navigation #}
{% if tab_group.show_single_tab or tabs|length > 1 %}
<ul id="{{ tab_group.get_id }}" {{ tab_group.attr_string|safe }}> <ul id="{{ tab_group.get_id }}" {{ tab_group.attr_string|safe }}>
{% for tab in tabs %} {% for tab in tabs %}
<li {{ tab.attr_string|safe }}> <li {{ tab.attr_string|safe }}>
@ -9,6 +10,7 @@
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %}
{# Tab Content #} {# Tab Content #}
<div class="tab-content"> <div class="tab-content">