--- a/src/pyams_skin/table.py Sat Feb 21 13:52:31 2015 +0100
+++ b/src/pyams_skin/table.py Sat Feb 21 13:54:19 2015 +0100
@@ -56,7 +56,7 @@
class BaseTable(Table):
"""Custom table"""
- id = _("TableID")
+ id = "TableID"
title = _("Container elements")
cssClasses = {'table': 'table table-bordered table-striped table-hover table-tight datatable'}
@@ -119,30 +119,47 @@
.replace('<td', '<td %s' % self.get_data_attributes('td', item, column))
+class I18nColumn(object):
+ """Column with I18n header column"""
+
+ _header = None
+ request = None
+
+ @property
+ def header(self):
+ if not self._header:
+ return ''
+ return self.request.localizer.translate(self._header)
+
+
@adapter_config(name='name', context=(Interface, IPyAMSLayer, BaseTable), provides=IColumn)
-class NameColumn(GetAttrColumn):
- """Container column"""
+class NameColumn(I18nColumn, GetAttrColumn):
+ """Container name column"""
- header = _("Name")
+ _header = _("Name")
attrName = '__name__'
+ weight = 10
class ActionColumn(Column):
"""Base action icon column"""
header = ''
- icon_class = 'fa fa-fw fa-search'
- icon_hint = _("Search")
+ icon_class = 'fa fa-fw fa-edit'
+ icon_hint = _("Properties")
cssClasses = {'th': 'action',
'td': 'action'}
url = "#"
target = '#content'
modal_target = False
+ permission = None
def renderCell(self, item):
+ if self.permission and not self.request.has_permission(self.permission):
+ return ''
translate = self.request.localizer.translate
return '''<a class="hint" title="{title}" href="{url}"
- data-ams-target="{target}" {modal} data-ams-hint-gravity="se">
+ data-ams-target="{target}" {modal} data-ams-hint-gravity="e">
<i class="{icon_class}"></i>
</a>'''.format(title=translate(self.icon_hint),
url=self.get_url(item),