Added base paragraph empty title
authorThierry Florac <thierry.florac@onf.fr>
Wed, 04 Apr 2018 14:41:57 +0200
changeset 513 c65e71af9288
parent 512 f282127bc420
child 514 27a1c8d531b9
Added base paragraph empty title
src/pyams_content/component/paragraph/__init__.py
src/pyams_content/component/paragraph/zmi/container.py
--- a/src/pyams_content/component/paragraph/__init__.py	Tue Apr 03 17:10:39 2018 +0200
+++ b/src/pyams_content/component/paragraph/__init__.py	Wed Apr 04 14:41:57 2018 +0200
@@ -82,6 +82,8 @@
     visible = FieldProperty(IBaseParagraph['visible'])
     title = FieldProperty(IBaseParagraph['title'])
 
+    empty_title = ' -' * 8
+
 
 @implementer(IParagraphFactory)
 class BaseParagraphFactory(object):
@@ -129,7 +131,7 @@
             terms = [SimpleTerm(para.__name__,
                                 title='ยง{0}: {1}'.format(index+1,
                                                          II18n(para).query_attribute('title', request=request) or
-                                                         '----'))
+                                                         BaseParagraph.empty_title))
                      for index, para in enumerate(IParagraphContainer(context).values())]
         else:
             terms = []
--- a/src/pyams_content/component/paragraph/zmi/container.py	Tue Apr 03 17:10:39 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/container.py	Wed Apr 04 14:41:57 2018 +0200
@@ -36,6 +36,7 @@
 
 # import packages
 from pyams_content.component.association.zmi import AssociationsContainerView
+from pyams_content.component.paragraph import BaseParagraph
 from pyams_content.shared.common.zmi import WfModifiedContentColumnMixin
 from pyams_content.skin import pyams_content
 from pyams_form.security import ProtectedFormObjectMixin
@@ -229,7 +230,7 @@
         return '<span class="title">{0}</span>'.format(super(ParagraphContainerBaseTitleColumn, self).renderCell(item))
 
     def getValue(self, obj):
-        return II18n(obj).query_attribute('title', request=self.request) or ' - - - - - - - -'
+        return II18n(obj).query_attribute('title', request=self.request) or BaseParagraph.empty_title
 
 
 @adapter_config(name='name', context=(IParagraphContainerTarget, IPyAMSLayer, ParagraphContainerTable),
@@ -413,7 +414,8 @@
             if associations is not None:
                 view = AssociationsContainerView(paragraph, self.request)
                 view.widget_icon_class = 'fa fa-fw {0}'.format(paragraph.icon_class)
-                view.title = II18n(paragraph).query_attribute('title', request=self.request) or ' - - - - - - - -'
+                view.title = II18n(paragraph).query_attribute('title', request=self.request) or \
+                             BaseParagraph.empty_title
                 result.append(view)
         return result