Updated Milestone and Pictogram paragraph fields dev-dc
authorDamien Correia
Thu, 06 Sep 2018 18:10:04 +0200
branchdev-dc
changeset 935 8a7ec586dce1
parent 934 437971f8a969
child 936 2b31cde8c028
child 999 f50be61c93a6
Updated Milestone and Pictogram paragraph fields
src/pyams_content/component/paragraph/interfaces/milestone.py
src/pyams_content/component/paragraph/milestone.py
src/pyams_content/component/paragraph/zmi/milestone.py
src/pyams_content/component/paragraph/zmi/pictogram.py
--- a/src/pyams_content/component/paragraph/interfaces/milestone.py	Thu Sep 06 18:06:14 2018 +0200
+++ b/src/pyams_content/component/paragraph/interfaces/milestone.py	Thu Sep 06 18:10:04 2018 +0200
@@ -21,7 +21,7 @@
 from zope.annotation.interfaces import IAttributeAnnotatable
 
 # import packages
-from pyams_i18n.schema import I18nTextLineField
+from pyams_i18n.schema import I18nTextLineField, I18nTextField
 from zope.container.constraints import containers, contains
 from zope.interface import Interface
 from zope.schema import Bool, Choice
@@ -80,6 +80,10 @@
 class IMilestoneParagraph(IMilestoneContainerTarget, IBaseParagraph):
     """Milestones paragraph interface"""
 
+    body = I18nTextField(title=_("Associated text"),
+                              description=_("Additional text associated to this milestone Paragraph"),
+                              required=False)
+
     renderer = Choice(title=_("Milestones template"),
                       description=_("Presentation template used for milestones"),
                       vocabulary=MILESTONE_PARAGRAPH_RENDERERS,
--- a/src/pyams_content/component/paragraph/milestone.py	Thu Sep 06 18:06:14 2018 +0200
+++ b/src/pyams_content/component/paragraph/milestone.py	Thu Sep 06 18:10:04 2018 +0200
@@ -220,7 +220,7 @@
 
     icon_class = 'fa-arrows-h'
     icon_hint = MILESTONE_PARAGRAPH_NAME
-
+    body = FieldProperty(IMilestoneParagraph['body'])
     renderer = FieldProperty(IMilestoneParagraph['renderer'])
 
 
--- a/src/pyams_content/component/paragraph/zmi/milestone.py	Thu Sep 06 18:06:14 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/milestone.py	Thu Sep 06 18:10:04 2018 +0200
@@ -74,29 +74,29 @@
                 layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=600)
 class MilestoneParagraphAddMenu(BaseParagraphAddMenu):
     """Milestone paragraph add menu"""
-    
+
     label = _("Milestones...")
     label_css_class = 'fa fa-fw fa-arrows-h'
     url = 'add-milestone-paragraph.html'
     paragraph_type = MILESTONE_PARAGRAPH_TYPE
-    
-    
+
+
 @pagelet_config(name='add-milestone-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
                 permission=MANAGE_CONTENT_PERMISSION)
 @ajax_config(name='add-milestone-paragraph.json', context=IParagraphContainerTarget, layer=IPyAMSLayer,
              base=BaseParagraphAJAXAddForm)
 class MilestoneParagraphAddForm(AdminDialogAddForm):
     """Milestone paragraph add form"""
-    
+
     legend = _("Add new milestone paragraph")
     icon_css_class = 'fa fa-fw fa-arrows-h'
 
-    fields = field.Fields(IMilestoneParagraph).select('title', 'renderer')
+    fields = field.Fields(IMilestoneParagraph).omit(*PARAGRAPH_HIDDEN_FIELDS)
     edit_permission = MANAGE_CONTENT_PERMISSION
 
     def create(self, data):
         return MilestoneParagraph()
-    
+
     def add(self, object):
         IParagraphContainer(self.context).append(object)
 
@@ -118,7 +118,7 @@
     legend = _("Edit milestone paragraph properties")
     icon_css_class = 'fa fa-fw fa-arrows-h'
 
-    fields = field.Fields(IMilestoneParagraph).select('title', 'renderer')
+    fields = field.Fields(IMilestoneParagraph).omit(*PARAGRAPH_HIDDEN_FIELDS)
     fields['renderer'].widgetFactory = RendererFieldWidget
 
     edit_permission = MANAGE_CONTENT_PERMISSION
@@ -320,7 +320,7 @@
     legend = _("Add new milestone")
     icon_css_class = 'fa fa-fw fa-arrow-h'
 
-    fields = field.Fields(IMilestone).omit(*PARAGRAPH_HIDDEN_FIELDS)
+    fields = field.Fields(IMilestone).omit('__parent__', '__name__', 'visible')
     edit_permission = MANAGE_CONTENT_PERMISSION
 
     def create(self, data):
@@ -347,7 +347,7 @@
     legend = _("Edit milestone properties")
     icon_css_class = 'fa fa-fw fa-arrows-h'
 
-    fields = field.Fields(IMilestone).omit(*PARAGRAPH_HIDDEN_FIELDS)
+    fields = field.Fields(IMilestone).omit('__parent__', '__name__', 'visible')
     edit_permission = MANAGE_CONTENT_PERMISSION
 
     def get_ajax_output(self, changes):
--- a/src/pyams_content/component/paragraph/zmi/pictogram.py	Thu Sep 06 18:06:14 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/pictogram.py	Thu Sep 06 18:10:04 2018 +0200
@@ -79,29 +79,29 @@
                 layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=600)
 class PictogramParagraphAddMenu(BaseParagraphAddMenu):
     """Pictogram paragraph add menu"""
-    
+
     label = _("Pictograms...")
     label_css_class = 'fa fa-fw fa-linode'
     url = 'add-pictogram-paragraph.html'
     paragraph_type = PICTOGRAM_PARAGRAPH_TYPE
-    
-    
+
+
 @pagelet_config(name='add-pictogram-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
                 permission=MANAGE_CONTENT_PERMISSION)
 @ajax_config(name='add-pictogram-paragraph.json', context=IParagraphContainerTarget, layer=IPyAMSLayer,
              base=BaseParagraphAJAXAddForm)
 class PictogramParagraphAddForm(AdminDialogAddForm):
     """Pictogram paragraph add form"""
-    
+
     legend = _("Add new pictogram paragraph")
     icon_css_class = 'fa fa-fw fa-linode'
-    
-    fields = field.Fields(IPictogramParagraph).select('title', 'renderer')
+
+    fields = field.Fields(IPictogramParagraph).omit(*PARAGRAPH_HIDDEN_FIELDS)
     edit_permission = MANAGE_CONTENT_PERMISSION
-    
+
     def create(self, data):
         return PictogramParagraph()
-    
+
     def add(self, object):
         IParagraphContainer(self.context).append(object)
 
@@ -123,7 +123,7 @@
     legend = _("Edit pictogram paragraph properties")
     icon_css_class = 'fa fa-fw fa-linode'
 
-    fields = field.Fields(IPictogramParagraph).select('title', 'renderer')
+    fields = field.Fields(IPictogramParagraph).omit(*PARAGRAPH_HIDDEN_FIELDS)
     fields['renderer'].widgetFactory = RendererFieldWidget
 
     edit_permission = MANAGE_CONTENT_PERMISSION
@@ -327,7 +327,7 @@
     legend = _("Add new pictogram")
     icon_css_class = 'fa fa-fw fa-arrow-h'
 
-    fields = field.Fields(IPictogramItem).omit(*PARAGRAPH_HIDDEN_FIELDS)
+    fields = field.Fields(IPictogramItem).omit('__parent__', '__name__', 'visible')
     fields['pictogram_name'].widgetFactory = PictogramSelectFieldWidget
 
     edit_permission = MANAGE_CONTENT_PERMISSION
@@ -369,7 +369,7 @@
     legend = _("Edit pictogram properties")
     icon_css_class = 'fa fa-fw fa-linode'
 
-    fields = field.Fields(IPictogramItem).omit(*PARAGRAPH_HIDDEN_FIELDS)
+    fields = field.Fields(IPictogramItem).omit('__parent__', '__name__', 'visible')
     fields['pictogram_name'].widgetFactory = PictogramSelectFieldWidget
 
     edit_permission = MANAGE_CONTENT_PERMISSION