Define table header visibility using hidden_title meta

As Horizon now supports hidden_title meta in tables, we can replace stylesheet solution

Change-Id: Ifed820fb4b5942b02f11124ee916d8cc7ea506a5
This commit is contained in:
Jiri Tomasek 2014-11-14 16:19:14 +01:00
parent 75a5429dfd
commit bef0a07f4d
8 changed files with 13 additions and 17 deletions

View File

@ -129,6 +129,7 @@ class FlavorRolesTable(horizon.tables.DataTable):
verbose_name = _("Overcloud Roles") verbose_name = _("Overcloud Roles")
table_actions = () table_actions = ()
row_actions = () row_actions = ()
hidden_title = False
template = "horizon/common/_enhanced_data_table.html" template = "horizon/common/_enhanced_data_table.html"

View File

@ -24,12 +24,12 @@
</thead> </thead>
</table> </table>
<div id="suggested-flavors" class="panel-collapse collapse no-table-title"> <div id="suggested-flavors" class="panel-collapse collapse">
{{ suggested_flavors_table.render }} {{ suggested_flavors_table.render }}
</div> </div>
{% endif %} {% endif %}
<div id="flavors" class="no-table-title"> <div id="flavors">
{{ flavors_table.render }} {{ flavors_table.render }}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -9,10 +9,8 @@
{% block main %} {% block main %}
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<div class="no-table-title"> {% comment %}This will likely move to the tables Meta in the future{% endcomment %}
{{ table.render }} {{ table.render }}
</div> </div>
</div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -9,10 +9,8 @@
{% block main %} {% block main %}
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<div class="no-table-title"> {% comment %}This will likely move to the tables Meta in the future{% endcomment %}
{{ table.render }} {{ table.render }}
</div> </div>
</div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -188,6 +188,7 @@ class AllNodesTable(BaseNodesTable):
class Meta: class Meta:
name = "all_nodes_table" name = "all_nodes_table"
verbose_name = _("All") verbose_name = _("All")
hidden_title = False
columns = ('node', 'cpus', 'memory_mb', 'local_gb', 'power_status', columns = ('node', 'cpus', 'memory_mb', 'local_gb', 'power_status',
'state') 'state')
table_actions = (NodeFilterAction, SetPowerStateOn, SetPowerStateOff, table_actions = (NodeFilterAction, SetPowerStateOn, SetPowerStateOff,
@ -201,6 +202,7 @@ class ProvisionedNodesTable(BaseNodesTable):
class Meta: class Meta:
name = "provisioned_nodes_table" name = "provisioned_nodes_table"
verbose_name = _("Provisioned") verbose_name = _("Provisioned")
hidden_title = False
table_actions = (NodeFilterAction, SetPowerStateOn, SetPowerStateOff, table_actions = (NodeFilterAction, SetPowerStateOn, SetPowerStateOff,
DeleteNode) DeleteNode)
row_actions = (SetPowerStateOn, SetPowerStateOff, DeleteNode) row_actions = (SetPowerStateOn, SetPowerStateOff, DeleteNode)
@ -212,6 +214,7 @@ class FreeNodesTable(BaseNodesTable):
class Meta: class Meta:
name = "free_nodes_table" name = "free_nodes_table"
verbose_name = _("Free") verbose_name = _("Free")
hidden_title = False
columns = ('node', 'cpus', 'memory_mb', 'local_gb', 'power_status') columns = ('node', 'cpus', 'memory_mb', 'local_gb', 'power_status')
table_actions = (NodeFilterAction, SetPowerStateOn, SetPowerStateOff, table_actions = (NodeFilterAction, SetPowerStateOn, SetPowerStateOff,
DeleteNode) DeleteNode)
@ -224,6 +227,7 @@ class MaintenanceNodesTable(BaseNodesTable):
class Meta: class Meta:
name = "maintenance_nodes_table" name = "maintenance_nodes_table"
verbose_name = _("Maintenance") verbose_name = _("Maintenance")
hidden_title = False
columns = ('node', 'cpus', 'memory_mb', 'local_gb', 'power_status', columns = ('node', 'cpus', 'memory_mb', 'local_gb', 'power_status',
'state') 'state')
table_actions = (NodeFilterAction, ActivateNode, SetPowerStateOn, table_actions = (NodeFilterAction, ActivateNode, SetPowerStateOn,

View File

@ -9,10 +9,8 @@
{% block main %} {% block main %}
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<div class="no-table-title"> {% comment %}This will likely move to the tables Meta in the future{% endcomment %}
{{ table.render }} {{ table.render }}
</div> </div>
</div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,8 +1,3 @@
// Some tables should not have a title because it just repeats the page title.
.no-table-title tr.table_caption {
display: none;
}
tr.table_actions_row { tr.table_actions_row {
th.table_header { th.table_header {
background: #f9f9f9; background: #f9f9f9;

View File

@ -1,11 +1,13 @@
{% extends "horizon/common/_data_table.html" %} {% extends "horizon/common/_data_table.html" %}
{% block table_caption %} {% block table_caption %}
{% if not hidden_title %}
<tr class='table_caption'> <tr class='table_caption'>
<th class='table_header' colspan='{{ columns|length }}'> <th class='table_header' colspan='{{ columns|length }}'>
<h3 class='table_title'>{{ table }}</h3> <h3 class='table_title'>{{ table }}</h3>
</th> </th>
</tr> </tr>
{% endif %}
{% if table.get_table_actions %} {% if table.get_table_actions %}
<tr class='table_actions_row'> <tr class='table_actions_row'>
<th class='table_header' colspan='{{ columns|length }}'> <th class='table_header' colspan='{{ columns|length }}'>