Minor updates
authortflorac@xsup98-004.onf.fr
Thu, 12 Oct 2017 22:32:05 +0200
changeset 205 af5d52115698
parent 204 eb6b575b4bf6
child 206 90e3fa165ce1
Minor updates
src/pyams_content/component/gallery/file.py
src/pyams_content/component/gallery/interfaces/__init__.py
src/pyams_content/component/gallery/zmi/interfaces.py
src/pyams_content/component/gallery/zmi/paragraph.py
--- a/src/pyams_content/component/gallery/file.py	Thu Oct 12 22:31:46 2017 +0200
+++ b/src/pyams_content/component/gallery/file.py	Thu Oct 12 22:32:05 2017 +0200
@@ -9,7 +9,6 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
-from pyams_file.interfaces import DELETED_FILE, IResponsiveImage
 
 __docformat__ = 'restructuredtext'
 
@@ -19,6 +18,7 @@
 # import interfaces
 from pyams_content.component.gallery.interfaces import IGalleryFile
 from pyams_content.shared.common.interfaces import IWfSharedContent
+from pyams_file.interfaces import DELETED_FILE, IResponsiveImage
 from pyams_form.interfaces.form import IFormContextPermissionChecker
 from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent
 
@@ -49,10 +49,10 @@
     description = FieldProperty(IGalleryFile['description'])
     author = FieldProperty(IGalleryFile['author'])
     author_comments = FieldProperty(IGalleryFile['author_comments'])
+    pif_number = FieldProperty(IGalleryFile['pif_number'])
     sound = FileProperty(IGalleryFile['sound'])
     sound_title = FieldProperty(IGalleryFile['sound_title'])
     sound_description = FieldProperty(IGalleryFile['sound_description'])
-    pif_number = FieldProperty(IGalleryFile['pif_number'])
     visible = FieldProperty(IGalleryFile['visible'])
 
     @property
--- a/src/pyams_content/component/gallery/interfaces/__init__.py	Thu Oct 12 22:31:46 2017 +0200
+++ b/src/pyams_content/component/gallery/interfaces/__init__.py	Thu Oct 12 22:32:05 2017 +0200
@@ -40,7 +40,6 @@
     containers('.IGallery')
 
     title = I18nTextLineField(title=_("Legend"),
-                              description=_("Image title"),
                               required=False)
 
     alt_title = I18nTextLineField(title=_("Accessibility title"),
@@ -55,12 +54,17 @@
                                 required=False)
 
     author = TextLine(title=_("Author"),
+                      description=_("Name of document's author"),
                       required=False)
 
     author_comments = I18nTextField(title=_("Author's comments"),
                                     description=_("Comments relatives to author's rights management"),
                                     required=False)
 
+    pif_number = TextLine(title=_("PIF number"),
+                          description=_("Number used to identify media into national library database"),
+                          required=False)
+
     sound = FileField(title=_("Audio data"),
                       description=_("Sound file associated with the current media"),
                       required=False)
@@ -73,10 +77,6 @@
                                       description=_("Short description of associated sound file"),
                                       required=False)
 
-    pif_number = TextLine(title=_("PIF number"),
-                          description=_("Number used to identify media into national library database"),
-                          required=False)
-
     visible = Bool(title=_("Visible image?"),
                    description=_("If 'no', this image won't be displayed in front office"),
                    required=True,
--- a/src/pyams_content/component/gallery/zmi/interfaces.py	Thu Oct 12 22:31:46 2017 +0200
+++ b/src/pyams_content/component/gallery/zmi/interfaces.py	Thu Oct 12 22:32:05 2017 +0200
@@ -34,6 +34,7 @@
     """Gallery image add fields"""
 
     author = TextLine(title=_("Author"),
+                      description=_("Name of document's author"),
                       required=False)
 
     author_comments = I18nTextField(title=_("Author comments"),
--- a/src/pyams_content/component/gallery/zmi/paragraph.py	Thu Oct 12 22:31:46 2017 +0200
+++ b/src/pyams_content/component/gallery/zmi/paragraph.py	Thu Oct 12 22:32:05 2017 +0200
@@ -122,11 +122,13 @@
         updated = changes.get(IBaseGallery, ())
         if 'title' in updated:
             return {'status': 'success',
-                    'event': 'PyAMS_content.changed_item',
-                    'event_options': {'object_type': 'paragraph',
-                                      'object_name': self.context.__name__,
-                                      'title': II18n(self.context).query_attribute('title', request=self.request),
-                                      'visible': self.context.visible}}
+                    'events': [{
+                        'event': 'PyAMS_content.changed_item',
+                        'options': {'handler': 'PyAMS_content.paragraphs.refreshParagraph',
+                                    'object_name': self.context.__name__,
+                                    'title': II18n(self.context).query_attribute('title', request=self.request),
+                                    'visible': self.context.visible}
+                    }]}
         else:
             return super(GalleryPropertiesAJAXEditForm, self).get_ajax_output(changes)