Added Title field for Raw HTML portlet.
--- a/src/pyams_portal/portlets/html/__init__.py Tue Aug 28 15:42:39 2018 +0200
+++ b/src/pyams_portal/portlets/html/__init__.py Wed Aug 29 16:55:28 2018 +0200
@@ -40,6 +40,7 @@
class RawPortletSettings(PortletSettings):
"""Raw HTML code portlet settings"""
+ title = FieldProperty(IRawPortletSettings['title'])
body = FieldProperty(IRawPortletSettings['body'])
--- a/src/pyams_portal/portlets/html/interfaces.py Tue Aug 28 15:42:39 2018 +0200
+++ b/src/pyams_portal/portlets/html/interfaces.py Wed Aug 29 16:55:28 2018 +0200
@@ -19,8 +19,7 @@
from pyams_portal.interfaces import IPortletSettings
# import packages
-from pyams_i18n.schema import I18nTextField, I18nHTMLField
-
+from pyams_i18n.schema import I18nTextField, I18nHTMLField, I18nTextLineField
from pyams_portal import _
@@ -28,6 +27,8 @@
class IRawPortletSettings(IPortletSettings):
"""Raw HTML code portlet settings interface"""
+ title = I18nTextLineField(title=_("ยง Title"),
+ required=False)
body = I18nTextField(title=_("Raw HTML code"),
description=_("This HTML code will be used 'as is', without any transformation. Use with "
"care!!"),
--- a/src/pyams_portal/portlets/html/skin/__init__.py Tue Aug 28 15:42:39 2018 +0200
+++ b/src/pyams_portal/portlets/html/skin/__init__.py Wed Aug 29 16:55:28 2018 +0200
@@ -30,7 +30,7 @@
@adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, IRawPortletSettings), provides=IPortletRenderer)
-@template_config(template='html.pt', layer=IPyAMSLayer)
+@template_config(template='raw.pt', layer=IPyAMSLayer)
class RawPortletDefaultRenderer(PortletRenderer):
"""Raw HTML portlet renderer"""
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_portal/portlets/html/skin/raw.pt Wed Aug 29 16:55:28 2018 +0200
@@ -0,0 +1,3 @@
+<h3 tal:condition="i18n:view.settings.title"
+ tal:content="i18n:view.settings.title">Title</h3>
+<tal:var replace="structure i18n:view.settings.body">HTML code</tal:var>
--- a/src/pyams_portal/portlets/html/zmi/__init__.py Tue Aug 28 15:42:39 2018 +0200
+++ b/src/pyams_portal/portlets/html/zmi/__init__.py Wed Aug 29 16:55:28 2018 +0200
@@ -61,7 +61,7 @@
@adapter_config(context=(Interface, IPyAMSLayer, Interface, IRawPortletSettings), provides=IPortletPreviewer)
-@template_config(template='preview.pt', layer=IPyAMSLayer)
+@template_config(template='raw-preview.pt', layer=IPyAMSLayer)
class RawPortletPreviewer(PortletPreviewer):
"""Raw HTML portlet previewer"""
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_portal/portlets/html/zmi/raw-preview.pt Wed Aug 29 16:55:28 2018 +0200
@@ -0,0 +1,5 @@
+<strong tal:define="title i18n:view.settings.title"
+ tal:condition="title">
+ <tal:var content="title" /><br />
+</strong>
+<tal:var replace="structure i18n:view.settings.body">HTML code</tal:var>