Added dashed style on disabled tasks
authorThierry Florac <thierry.florac@onf.fr>
Wed, 11 Mar 2015 17:16:21 +0100
changeset 2 7b56f247a0c4
parent 1 855ea452bd97
child 3 13a265dc6051
Added dashed style on disabled tasks
src/pyams_scheduler/zmi/scheduler.py
--- a/src/pyams_scheduler/zmi/scheduler.py	Wed Mar 11 11:54:35 2015 +0100
+++ b/src/pyams_scheduler/zmi/scheduler.py	Wed Mar 11 17:16:21 2015 +0100
@@ -102,14 +102,12 @@
             attributes['table'] = table_attrs
         return attributes
 
-
-@adapter_config(name='name', context=(Interface, IAdminLayer, SchedulerTasksTable), provides=IColumn)
-class SchedulerTasksNameColumn(I18nColumn, GetAttrColumn):
-    """Scheduler tasks name column"""
-
-    _header = _("Name")
-    attrName = 'name'
-    weight = 10
+    def getCSSHighlightClass(self, column, item, cssClass):
+        if column.__name__ == 'name':
+            info = item.get_scheduling_info(self.request.registry)
+            if info and not info.active:
+                cssClass = 'text-dashed'
+        return super(SchedulerTasksTable, self).getCSSHighlightClass(column, item, cssClass)
 
 
 @adapter_config(name='settings', context=(Interface, IAdminLayer, SchedulerTasksTable), provides=IColumn)
@@ -140,6 +138,15 @@
     weight = 2
 
 
+@adapter_config(name='name', context=(Interface, IAdminLayer, SchedulerTasksTable), provides=IColumn)
+class SchedulerTasksNameColumn(I18nColumn, GetAttrColumn):
+    """Scheduler tasks name column"""
+
+    _header = _("Name")
+    attrName = 'name'
+    weight = 10
+
+
 @adapter_config(name='run', context=(Interface, IAdminLayer, SchedulerTasksTable), provides=IColumn)
 class SchedulerTasksRunColumn(ActionColumn):
     """Scheduler tasks run column"""