Added title and updated icon class
authorThierry Florac <thierry.florac@onf.fr>
Wed, 06 Jun 2018 11:59:32 +0200
changeset 588 fafb10af74b3
parent 587 978dc30214ce
child 589 7a2af6e086a6
Added title and updated icon class
src/pyams_content/component/paragraph/keypoint.py
src/pyams_content/component/paragraph/zmi/keypoint.py
--- a/src/pyams_content/component/paragraph/keypoint.py	Wed Jun 06 11:59:16 2018 +0200
+++ b/src/pyams_content/component/paragraph/keypoint.py	Wed Jun 06 11:59:32 2018 +0200
@@ -28,7 +28,6 @@
 from pyams_utils.adapter import adapter_config
 from pyams_utils.factory import factory_config
 from pyams_utils.registry import utility_config, get_utility
-from pyams_utils.text import get_text_start
 from pyams_utils.traversing import get_parent
 from pyams_utils.vocabulary import vocabulary_config
 from zope.interface import implementer
@@ -40,14 +39,9 @@
 class KeypointsParagraph(BaseParagraph):
     """Key points paragraph"""
 
-    icon_class = 'fa-key'
+    icon_class = 'fa-list-ol'
     icon_hint = KEYPOINTS_PARAGRAPH_NAME
 
-    @property
-    def title(self):
-        body = II18n(self).query_attribute('body')
-        return get_text_start(body, 50, 10)
-
     body = FieldProperty(IKeypointsParagraph['body'])
     renderer = FieldProperty(IKeypointsParagraph['renderer'])
 
--- a/src/pyams_content/component/paragraph/zmi/keypoint.py	Wed Jun 06 11:59:16 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/keypoint.py	Wed Jun 06 11:59:32 2018 +0200
@@ -48,7 +48,7 @@
     """Key points paragraph add menu"""
 
     label = _("Key points...")
-    label_css_class = 'fa fa-fw fa-key'
+    label_css_class = 'fa fa-fw fa-list-ol'
     url = 'add-keypoints-paragraph.html'
     paragraph_type = KEYPOINTS_PARAGRAPH_TYPE
 
@@ -59,9 +59,9 @@
     """Key points paragraph add form"""
 
     legend = _("Add new key points paragraph")
-    icon_css_class = 'fa fa-fw fa-key'
+    icon_css_class = 'fa fa-fw fa-list-ol'
 
-    fields = field.Fields(IKeypointsParagraph).select('body', 'renderer')
+    fields = field.Fields(IKeypointsParagraph).omit('__parent__', '__name__', 'visible')
     ajax_handler = 'add-keypoints-paragraph.json'
     edit_permission = MANAGE_CONTENT_PERMISSION
 
@@ -91,9 +91,9 @@
     prefix = 'keypoints_properties.'
 
     legend = _("Edit key points paragraph properties")
-    icon_css_class = 'fa fa-fw fa-key'
+    icon_css_class = 'fa fa-fw fa-list-ol'
 
-    fields = field.Fields(IKeypointsParagraph).select('body', 'renderer')
+    fields = field.Fields(IKeypointsParagraph).omit('__parent__', '__name__', 'visible')
     fields['renderer'].widgetFactory = RendererFieldWidget
 
     ajax_handler = 'properties.json'
@@ -110,13 +110,6 @@
 class KeypointsParagraphPropertiesAJAXEditForm(BaseParagraphAJAXEditForm, KeypointsParagraphPropertiesEditForm):
     """Key points paragraph properties edit form, JSON renderer"""
 
-    def get_ajax_output(self, changes):
-        output = super(KeypointsParagraphPropertiesAJAXEditForm, self).get_ajax_output(changes)
-        if 'body' in changes.get(IKeypointsParagraph, ()):
-            output.setdefault('events', []).append(
-                get_json_paragraph_refresh_event(self.context, self.request))
-        return output
-
 
 @adapter_config(context=(IKeypointsParagraph, IPyAMSLayer), provides=IParagraphInnerEditor)
 @implementer(IInnerForm)