Permalink
Browse files

High-light selected container in browser

Fixed bug #1038264
Change-Id: I46c1d2faf58872d9ed72ee9f6f0f9c4d61d20756
  • Loading branch information...
diamrem committed Aug 17, 2012
1 parent 156a368 commit 9fff560cbde5519fb2af0a6f933f2da68430b48d
Showing with 18 additions and 5 deletions.
  1. +6 −4 horizon/browsers/base.py
  2. +7 −1 horizon/tables/base.py
  3. +5 −0 openstack_dashboard/static/dashboard/less/horizon.less
View
@@ -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,
View
@@ -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:
@@ -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 = []
@@ -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.
@@ -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;
@@ -1464,6 +1467,7 @@ label.log-length {
white-space: nowrap;
}
tbody td {
+ border-right: @dataTableBorderWidth solid @dataTableBorderColor;
background-color: @white;
}
}
@@ -1475,6 +1479,7 @@ label.log-length {
border-top-left-radius: 0;
}
td{
+ border-bottom: @dataTableBorderWidth solid @dataTableBorderColor;
&:last-child {
border-right: 0 none;
}

0 comments on commit 9fff560

Please sign in to comment.