--- a/src/pyams_portal/zmi/template.py Mon Jun 18 17:11:37 2018 +0200
+++ b/src/pyams_portal/zmi/template.py Wed Jun 20 08:25:43 2018 +0200
@@ -19,6 +19,7 @@
from pyams_portal.interfaces import IPortalTemplateContainer, IPortalTemplate, IPortalContext, \
MANAGE_TEMPLATE_PERMISSION
from pyams_skin.interfaces import IPageHeader, IContentTitle
+from pyams_skin.interfaces.container import ITableElementName, ITableElementEditor
from pyams_skin.interfaces.viewlet import IWidgetTitleViewletManager, IBreadcrumbItem
from pyams_skin.layer import IPyAMSLayer
from pyams_zmi.layer import IAdminLayer
@@ -31,9 +32,10 @@
from pyams_portal.template import PortalTemplate
from pyams_portal.zmi.container import PortalTemplateContainerTable
from pyams_skin.page import DefaultPageHeaderAdapter
+from pyams_skin.table import DefaultElementEditorAdapter
from pyams_skin.viewlet.breadcrumb import BreadcrumbItem
from pyams_skin.viewlet.toolbar import ToolbarAction
-from pyams_utils.adapter import adapter_config
+from pyams_utils.adapter import adapter_config, ContextRequestAdapter
from pyams_utils.registry import query_utility
from pyams_utils.traversing import get_parent
from pyams_utils.unicode import translate_string
@@ -54,6 +56,31 @@
label = _("Portal template")
+@adapter_config(context=(IPortalTemplate, IPyAMSLayer), provides=ITableElementName)
+class PortalTemplateTableElementNameAdapter(ContextRequestAdapter):
+ """Portal template table element name adapter"""
+
+ @property
+ def name(self):
+ container = get_parent(self.context, IPortalTemplateContainer)
+ if container is not None:
+ return self.context.name
+ context = get_parent(self.context, IPortalContext)
+ if context is not None:
+ adapter = self.request.registry.queryMultiAdapter((context, self.request), ITableElementName)
+ if adapter is not None:
+ return self.request.localizer.translate(_("{0} (local template)")).format(adapter.name)
+ return '--'
+
+
+@adapter_config(context=(IPortalTemplate, IAdminLayer, Interface), provides=ITableElementEditor)
+class PortalTemplateTableElementEditorAdapter(DefaultElementEditorAdapter):
+ """Portal template table element editor adapter"""
+
+ view_name = 'admin#properties.html'
+ modal_target = False
+
+
@adapter_config(context=(IPortalTemplate, IPyAMSLayer, Interface), provides=IPageHeader)
class PortalTemplateHeaderAdapter(DefaultPageHeaderAdapter):
"""Portal template header adapter"""