Updated JSON output on link properties update
authorThierry Florac <thierry.florac@onf.fr>
Wed, 27 Jun 2018 15:15:13 +0200
changeset 758 6aca2a06cbe3
parent 757 72e2df59af62
child 759 780d6776a857
Updated JSON output on link properties update
src/pyams_content/shared/site/zmi/link.py
--- a/src/pyams_content/shared/site/zmi/link.py	Wed Jun 27 15:01:45 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/link.py	Wed Jun 27 15:15:13 2018 +0200
@@ -9,6 +9,7 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
+from pyams_skin.event import get_json_table_row_refresh_event
 
 __docformat__ = 'restructuredtext'
 
@@ -21,7 +22,6 @@
 from pyams_content.shared.site.interfaces import ISiteContainer, IContentLink
 from pyams_content.skin.zmi.interfaces import ISiteTreeTable
 from pyams_i18n.interfaces import II18n
-from pyams_sequence.interfaces import IInternalReference
 from pyams_skin.interfaces.container import ITableElementName
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
@@ -31,7 +31,7 @@
 
 # import packages
 from pyams_content.shared.site.link import ContentLink
-from pyams_content.shared.site.zmi.container import SiteContainerTreeTable, SiteContainerTreeNameColumn
+from pyams_content.shared.site.zmi.container import SiteContainerTreeTable
 from pyams_content.shared.site.zmi.widget import SiteManagerFoldersSelectorFieldWidget
 from pyams_form.form import AJAXAddForm, ajax_config
 from pyams_pagelet.pagelet import pagelet_config
@@ -140,7 +140,7 @@
     def get_ajax_output(self, changes):
         output = super(self.__class__, self).get_ajax_output(changes)
         intids = get_utility(IIntIds)
-        if 'reference' in changes.get(IInternalReference, ()):
+        if changes:
             table = SiteContainerTreeTable(self.context.__parent__, self.request)
             table.update()
             row = table.setUpRow(self.context)
@@ -152,16 +152,4 @@
                     'row': table.renderRow(row)
                 }
             })
-        elif 'alt_title' in changes.get(IContentLink, ()):
-            adapter = ContentLinkTableElementName(self.context, self.request, None)
-            column = SiteContainerTreeNameColumn(self.context, self.request, None)
-            output.setdefault('events', []).append({
-                'event': 'myams.refresh',
-                'options': {
-                    'handler': 'MyAMS.skin.refreshRowCell',
-                    'object_id': '{0}::{1}'.format(SiteContainerTreeTable.id, intids.queryId(self.context)),
-                    'col_name': 'name',
-                    'cell': column.renderCell(self.context, name=adapter.name)
-                }
-            })
         return output