src/pyams_content/component/links/zmi/container.py
changeset 7 cbc55162b64e
parent 0 7c0001cacf8e
child 53 4acef7070de7
--- a/src/pyams_content/component/links/zmi/container.py	Thu Oct 15 15:42:01 2015 +0200
+++ b/src/pyams_content/component/links/zmi/container.py	Mon Jan 18 16:08:07 2016 +0100
@@ -209,3 +209,13 @@
              permission=MANAGE_CONTENT_PERMISSION, renderer='json', xhr=True)
 class LinkLinksContainerAJAXEditForm(AJAXEditForm, LinkLinksContainerLinksEditForm):
     """Links links container edit form, JSON renderer"""
+
+    def get_ajax_output(self, changes):
+        if 'links' in changes.get(ILinkLinksContainer, ()):
+            return {'status': 'success',
+                    'event': 'PyAMS_content.changed_item',
+                    'event_options': {'object_type': 'links_container',
+                                      'object_name': self.context.__name__,
+                                      'nb_links': len(ILinkLinksContainer(self.context).links or ())}}
+        else:
+            return super(LinkLinksContainerAJAXEditForm, self).get_ajax_output(changes)