Added optional title to site summary portlet
authorThierry Florac <thierry.florac@onf.fr>
Mon, 26 Nov 2018 09:34:08 +0100
changeset 1118 ed551ca7c4de
parent 1117 60f1d91b671c
child 1119 7cf3b2b7841e
Added optional title to site summary portlet
src/pyams_content/shared/site/portlet/__init__.py
src/pyams_content/shared/site/portlet/interfaces.py
src/pyams_content/shared/site/portlet/zmi/templates/site-summary-preview.pt
--- a/src/pyams_content/shared/site/portlet/__init__.py	Mon Nov 26 09:32:56 2018 +0100
+++ b/src/pyams_content/shared/site/portlet/__init__.py	Mon Nov 26 09:34:08 2018 +0100
@@ -31,6 +31,7 @@
 class SiteContainerSummaryPortletSettings(PortletSettings):
     """Site container summary portlet settings"""
 
+    title = FieldProperty(ISiteContainerSummaryPortletSettings['title'])
     button_title = FieldProperty(ISiteContainerSummaryPortletSettings['button_title'])
 
 
--- a/src/pyams_content/shared/site/portlet/interfaces.py	Mon Nov 26 09:32:56 2018 +0100
+++ b/src/pyams_content/shared/site/portlet/interfaces.py	Mon Nov 26 09:34:08 2018 +0100
@@ -21,6 +21,9 @@
 class ISiteContainerSummaryPortletSettings(IPortletSettings):
     """Site container summary portlet settings"""
 
+    title = I18nTextLineField(title=_("Title"),
+                              required=False)
+
     button_title = I18nTextLineField(title=_("Button's title"),
                                      description=_("Navigation button's title is normally defined based on "
                                                    "target's content type; you can override this label by giving a "
--- a/src/pyams_content/shared/site/portlet/zmi/templates/site-summary-preview.pt	Mon Nov 26 09:32:56 2018 +0100
+++ b/src/pyams_content/shared/site/portlet/zmi/templates/site-summary-preview.pt	Mon Nov 26 09:34:08 2018 +0100
@@ -1,4 +1,8 @@
 <div tal:define="settings view.settings;" i18n:domain="pyams_content">
+	<i18n:var translate="">Title :</i18n:var>
+	<tal:var define="title i18n:settings.title">
+		${title or '--'}
+	</tal:var><br />
 	<i18n:var translate="">Navigation button title: </i18n:var>
 	<tal:var define="title i18n:settings.button_title">
 		${title or '--'}