Added property to display navigation links in paragraphs container portlet
authorThierry Florac <thierry.florac@onf.fr>
Thu, 29 Nov 2018 15:35:49 +0100
changeset 1140 1df391914ba5
parent 1139 b99e7d0757cd
child 1141 a033c4cad074
Added property to display navigation links in paragraphs container portlet
src/pyams_content/component/paragraph/portlet/__init__.py
src/pyams_content/component/paragraph/portlet/interfaces.py
src/pyams_content/component/paragraph/portlet/zmi/templates/container-preview.pt
--- a/src/pyams_content/component/paragraph/portlet/__init__.py	Thu Nov 29 10:40:41 2018 +0100
+++ b/src/pyams_content/component/paragraph/portlet/__init__.py	Thu Nov 29 15:35:49 2018 +0100
@@ -50,6 +50,7 @@
     paragraphs = FieldProperty(IParagraphContainerPortletSettings['paragraphs'])
     factories = FieldProperty(IParagraphContainerPortletSettings['factories'])
     anchors_only = FieldProperty(IParagraphContainerPortletSettings['anchors_only'])
+    display_navigation_links = FieldProperty(IParagraphContainerPortletSettings['display_navigation_links'])
 
     def get_paragraphs_labels(self):
         if not self.paragraphs:
--- a/src/pyams_content/component/paragraph/portlet/interfaces.py	Thu Nov 29 10:40:41 2018 +0100
+++ b/src/pyams_content/component/paragraph/portlet/interfaces.py	Thu Nov 29 15:35:49 2018 +0100
@@ -42,6 +42,12 @@
                         required=True,
                         default=False)
 
+    display_navigation_links = Bool(title=_("Display navigation links?"),
+                                    description=_("If 'no', navigation links to previous and next contents "
+                                                  "will not be displayed"),
+                                    required=True,
+                                    default=True)
+
 
 class IParagraphNavigationPortletSettings(IPortletSettings):
     """Paragraphs container navigation settings interface"""
--- a/src/pyams_content/component/paragraph/portlet/zmi/templates/container-preview.pt	Thu Nov 29 10:40:41 2018 +0100
+++ b/src/pyams_content/component/paragraph/portlet/zmi/templates/container-preview.pt	Thu Nov 29 15:35:49 2018 +0100
@@ -18,4 +18,8 @@
 			<span i18n:translate="">Only display anchors</span>
 		</div>
 	</tal:if>
+	<div class="padding-x-10">
+		<i class="fa fa-fw fa-${'check-' if settings.display_navigation_links else ''}square-o"></i>
+		<span i18n:translate="">Navigation links</span>
+	</div>
 </tal:var>