src/pyams_content/component/paragraph/zmi/contact.py
changeset 1006 cbb65b4b8742
parent 1002 ab7787b3faf1
child 1082 18e6d6cddcc9
--- a/src/pyams_content/component/paragraph/zmi/contact.py	Tue Oct 09 15:05:38 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/contact.py	Tue Oct 09 15:06:10 2018 +0200
@@ -89,6 +89,20 @@
 
     edit_permission = MANAGE_CONTENT_PERMISSION
 
+    def get_ajax_output(self, changes):
+        output = super(self.__class__, self).get_ajax_output(changes)
+        updated = changes.get(IBaseParagraph, ())
+        if 'title' in updated:
+            output.setdefault('events', []).append(get_json_paragraph_refresh_event(self.context, self.request))
+        updated = changes.get(IContactParagraph, ())
+        if ('photo' in updated) or ('renderer' in updated):
+            # we have to commit transaction to be able to handle blobs...
+            if 'photo' in updated:
+                ITransactionManager(self.context).get().commit()
+            output.setdefault('events', []).append(get_json_form_refresh_event(self.context, self.request,
+                                                                               ContactParagraphInnerEditForm))
+        return output
+
 
 @adapter_config(context=(IContactParagraph, IPyAMSLayer), provides=IParagraphInnerEditor)
 @ajax_config(name='inner-properties.json', context=IContactParagraph, layer=IPyAMSLayer,
@@ -105,17 +119,3 @@
             return button.Buttons(IParagraphInnerEditFormButtons)
         else:
             return button.Buttons()
-
-    def get_ajax_output(self, changes):
-        output = super(self.__class__, self).get_ajax_output(changes)
-        updated = changes.get(IBaseParagraph, ())
-        if 'title' in updated:
-            output.setdefault('events', []).append(get_json_paragraph_refresh_event(self.context, self.request))
-        updated = changes.get(IContactParagraph, ())
-        if ('photo' in updated) or ('renderer' in updated):
-            # we have to commit transaction to be able to handle blobs...
-            if 'photo' in updated:
-                ITransactionManager(self.context).get().commit()
-            output.setdefault('events', []).append(get_json_form_refresh_event(self.context, self.request,
-                                                                               ContactParagraphInnerEditForm))
-        return output