Skip to content

Commit

Permalink
High-light selected container in browser
Browse files Browse the repository at this point in the history
Fixed bug #1038264
Change-Id: I46c1d2faf58872d9ed72ee9f6f0f9c4d61d20756
  • Loading branch information
kewu21 committed Aug 17, 2012
1 parent 156a368 commit 9fff560
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
10 changes: 6 additions & 4 deletions horizon/browsers/base.py
Expand Up @@ -127,12 +127,14 @@ def set_tables(self, tables):
"""
self.navigation_table = tables[self.navigation_table_class._meta.name]
self.content_table = tables[self.content_table_class._meta.name]
if self.has_breadcrumb:
self.prepare_breadcrumb(tables)

def prepare_breadcrumb(self, tables):
navigation_item = self.kwargs.get(self.navigation_kwarg_name)
content_path = self.kwargs.get(self.content_kwarg_name)
# Tells the navigation table what is selected.
self.navigation_table.current_item_id = navigation_item
if self.has_breadcrumb:
self.prepare_breadcrumb(tables, navigation_item, content_path)

def prepare_breadcrumb(self, tables, navigation_item, content_path):
if self.has_breadcrumb and navigation_item and content_path:
for table in tables.values():
table.breadcrumb = Breadcrumb(self.request,
Expand Down
8 changes: 7 additions & 1 deletion horizon/tables/base.py
Expand Up @@ -407,6 +407,7 @@ def __init__(self, table, datum=None):
super(Row, self).__init__()
self.table = table
self.datum = datum
self.selected = False
if self.datum:
self.load_cells()
else:
Expand Down Expand Up @@ -882,6 +883,7 @@ def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs):
self._needs_form_wrapper = needs_form_wrapper
self._no_data_message = self._meta.no_data_message
self.breadcrumb = None
self.current_item_id = None

# Create a new set
columns = []
Expand Down Expand Up @@ -1292,7 +1294,11 @@ def get_rows(self):
rows = []
try:
for datum in self.filtered_data:
rows.append(self._meta.row_class(self, datum))
row = self._meta.row_class(self, datum)
if self.get_object_id(datum) == self.current_item_id:
self.selected = True
row.classes.append('current_selected')
rows.append(row)
except:
# Exceptions can be swallowed at the template level here,
# re-raising as a TemplateSyntaxError makes them visible.
Expand Down
5 changes: 5 additions & 0 deletions openstack_dashboard/static/dashboard/less/horizon.less
Expand Up @@ -1452,6 +1452,9 @@ label.log-length {
max-width: 200px;
}
}
tr.current_selected td {
background-color: #E9F5FA;
}
tfoot td {
border-right: 0 none;
border-bottom-right-radius: 0;
Expand All @@ -1464,6 +1467,7 @@ label.log-length {
white-space: nowrap;
}
tbody td {
border-right: @dataTableBorderWidth solid @dataTableBorderColor;
background-color: @white;
}
}
Expand All @@ -1475,6 +1479,7 @@ label.log-length {
border-top-left-radius: 0;
}
td{
border-bottom: @dataTableBorderWidth solid @dataTableBorderColor;
&:last-child {
border-right: 0 none;
}
Expand Down

0 comments on commit 9fff560

Please sign in to comment.