Add 'data-uuid' attr for mobile grid list items, if applicable

This commit is contained in:
Lance Edgar 2017-08-02 12:04:32 -05:00
parent 09ffdba9ef
commit 5afa832684

View file

@ -964,7 +964,10 @@ class CustomWebhelpersGrid(webhelpers2_grid.Grid):
value = self.get_column_value(column_number, i, record, column_name) value = self.get_column_value(column_number, i, record, column_name)
if self.mobile: if self.mobile:
url = self.url_generator(record, i) url = self.url_generator(record, i)
return HTML.tag('li', tags.link_to(value, url)) attrs = {}
if hasattr(record, 'uuid'):
attrs['data_uuid'] = record.uuid
return HTML.tag('li', tags.link_to(value, url), **attrs)
if self.linked_columns and column_name in self.linked_columns: if self.linked_columns and column_name in self.linked_columns:
url = self.url_generator(record, i) url = self.url_generator(record, i)
value = tags.link_to(value, url) value = tags.link_to(value, url)