Merge branch doc-dc
authorThierry Florac <thierry.florac@onf.fr>
Wed, 13 Jun 2018 16:34:37 +0200
changeset 670 fecfd4969c4f
parent 669 43f6de0d1543 (current diff)
parent 668 a63bc2aa60bb (diff)
child 671 b6ca6378a8f8
Merge branch doc-dc
--- a/src/pyams_content/shared/imagemap/zmi/area.py	Wed Jun 13 16:32:17 2018 +0200
+++ b/src/pyams_content/shared/imagemap/zmi/area.py	Wed Jun 13 16:34:37 2018 +0200
@@ -9,6 +9,8 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
+from pyams_skin.event import get_json_table_row_refresh_event
+from pyams_utils.traversing import get_parent
 
 __docformat__ = 'restructuredtext'
 
@@ -24,7 +26,7 @@
 
 # import packages
 from pyams_content.shared.imagemap import ImageMapArea
-from pyams_content.shared.imagemap.zmi.container import ImagemapAreasContainerView
+from pyams_content.shared.imagemap.zmi.container import ImagemapAreasContainerView, ImagemapAreasTable
 from pyams_content.shared.imagemap.zmi.widget import ImgareaInputFieldWidget
 from pyams_form.form import AJAXAddForm, ajax_config
 from pyams_pagelet.pagelet import pagelet_config
@@ -125,3 +127,11 @@
     fields['area'].widgetFactory = ImgareaInputFieldWidget
 
     edit_permission = MANAGE_CONTENT_PERMISSION
+
+    def get_ajax_output(self, changes):
+        output = super(self.__class__, self).get_ajax_output(changes)
+        if changes:
+            container = get_parent(self.context, IWfImageMap)
+            output.setdefault('events', []).append(
+                get_json_table_row_refresh_event(container, self.request, ImagemapAreasTable, self.context))
+        return output
--- a/src/pyams_content/shared/imagemap/zmi/container.py	Wed Jun 13 16:32:17 2018 +0200
+++ b/src/pyams_content/shared/imagemap/zmi/container.py	Wed Jun 13 16:34:37 2018 +0200
@@ -89,11 +89,12 @@
     @property
     def data_attributes(self):
         attributes = super(ImagemapAreasTable, self).data_attributes
-        attributes['table'] = {
+        attributes.setdefault('table', {}).update({
+            'id': self.id,
             'data-ams-location': absolute_url(self.context, self.request),
             'data-ams-datatable-sort': 'false',
             'data-ams-datatable-pagination': 'false'
-        }
+        })
         return attributes
 
     @reify