Add default themes to data types
authorThierry Florac <thierry.florac@onf.fr>
Tue, 10 Jul 2018 15:47:59 +0200
changeset 826 eb16b1127e06
parent 825 3f5684390091
child 827 1eb993e1adfd
Add default themes to data types
src/pyams_content/shared/common/types.py
src/pyams_content/shared/common/zmi/types.py
--- a/src/pyams_content/shared/common/types.py	Tue Jul 10 15:47:30 2018 +0200
+++ b/src/pyams_content/shared/common/types.py	Tue Jul 10 15:47:59 2018 +0200
@@ -19,6 +19,7 @@
 from pyams_content.component.extfile.interfaces import IExtFileContainerTarget
 from pyams_content.component.links.interfaces import ILinkContainerTarget
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget
+from pyams_content.component.theme.interfaces import IThemesTarget
 from pyams_content.interfaces import MANAGE_TOOL_PERMISSION
 from pyams_content.shared.common.interfaces.types import IDataType, ISubType, IBaseDataType, ITypedSharedTool, \
     ITypedDataManager, DATA_MANAGER_ANNOTATION_KEY
@@ -60,7 +61,7 @@
     """Data sub-type persistent class"""
 
 
-@implementer(IDataType, IParagraphContainerTarget, IExtFileContainerTarget, ILinkContainerTarget)
+@implementer(IDataType, IParagraphContainerTarget, IExtFileContainerTarget, ILinkContainerTarget, IThemesTarget)
 class DataType(BaseDataType, OrderedContainer):
     """Data type persistent class"""
 
--- a/src/pyams_content/shared/common/zmi/types.py	Tue Jul 10 15:47:30 2018 +0200
+++ b/src/pyams_content/shared/common/zmi/types.py	Tue Jul 10 15:47:59 2018 +0200
@@ -190,6 +190,22 @@
     permission = MANAGE_TOOL_PERMISSION
 
 
+@adapter_config(name='themes', context=(ITypedSharedTool, IPyAMSLayer, TypedSharedToolTypesTable),
+                provides=IColumn)
+class TypedSharedToolTypesThemesColumn(ActionColumn):
+    """Typed shared tool types themes column"""
+
+    weight = 120
+
+    icon_class = 'fa fa-fw fa-tags'
+    icon_hint = _("Default themes")
+
+    url = 'themes-dialog.html'
+    modal_target = True
+
+    permission = MANAGE_TOOL_PERMISSION
+
+
 @adapter_config(name='trash', context=(ITypedSharedTool, IPyAMSLayer, TypedSharedToolTypesTable),
                 provides=IColumn)
 class TypedSharedToolTypesTrashColumn(TrashColumn):