High-light selected container in browser

Fixed bug #1038264
Change-Id: I46c1d2faf58872d9ed72ee9f6f0f9c4d61d20756
This commit is contained in:
Ke Wu 2012-08-17 14:20:32 -07:00
parent 156a368c63
commit 9fff560cbd
3 changed files with 18 additions and 5 deletions

View File

@ -127,12 +127,14 @@ class ResourceBrowser(html.HTMLElement):
""" """
self.navigation_table = tables[self.navigation_table_class._meta.name] self.navigation_table = tables[self.navigation_table_class._meta.name]
self.content_table = tables[self.content_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) navigation_item = self.kwargs.get(self.navigation_kwarg_name)
content_path = self.kwargs.get(self.content_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: if self.has_breadcrumb and navigation_item and content_path:
for table in tables.values(): for table in tables.values():
table.breadcrumb = Breadcrumb(self.request, table.breadcrumb = Breadcrumb(self.request,

View File

@ -407,6 +407,7 @@ class Row(html.HTMLElement):
super(Row, self).__init__() super(Row, self).__init__()
self.table = table self.table = table
self.datum = datum self.datum = datum
self.selected = False
if self.datum: if self.datum:
self.load_cells() self.load_cells()
else: else:
@ -882,6 +883,7 @@ class DataTable(object):
self._needs_form_wrapper = needs_form_wrapper self._needs_form_wrapper = needs_form_wrapper
self._no_data_message = self._meta.no_data_message self._no_data_message = self._meta.no_data_message
self.breadcrumb = None self.breadcrumb = None
self.current_item_id = None
# Create a new set # Create a new set
columns = [] columns = []
@ -1292,7 +1294,11 @@ class DataTable(object):
rows = [] rows = []
try: try:
for datum in self.filtered_data: 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: except:
# Exceptions can be swallowed at the template level here, # Exceptions can be swallowed at the template level here,
# re-raising as a TemplateSyntaxError makes them visible. # re-raising as a TemplateSyntaxError makes them visible.

View File

@ -1452,6 +1452,9 @@ label.log-length {
max-width: 200px; max-width: 200px;
} }
} }
tr.current_selected td {
background-color: #E9F5FA;
}
tfoot td { tfoot td {
border-right: 0 none; border-right: 0 none;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
@ -1464,6 +1467,7 @@ label.log-length {
white-space: nowrap; white-space: nowrap;
} }
tbody td { tbody td {
border-right: @dataTableBorderWidth solid @dataTableBorderColor;
background-color: @white; background-color: @white;
} }
} }
@ -1475,6 +1479,7 @@ label.log-length {
border-top-left-radius: 0; border-top-left-radius: 0;
} }
td{ td{
border-bottom: @dataTableBorderWidth solid @dataTableBorderColor;
&:last-child { &:last-child {
border-right: 0 none; border-right: 0 none;
} }