Updated JSON response
authorThierry Florac <thierry.florac@onf.fr>
Fri, 10 Nov 2017 11:56:59 +0100
changeset 257 429496aab23b
parent 256 8e2207197a9a
child 258 ef411e4f8cb2
Updated JSON response
src/pyams_content/component/association/zmi/__init__.py
--- a/src/pyams_content/component/association/zmi/__init__.py	Fri Nov 10 11:56:30 2017 +0100
+++ b/src/pyams_content/component/association/zmi/__init__.py	Fri Nov 10 11:56:59 2017 +0100
@@ -37,7 +37,7 @@
 from pyams_utils.traversing import get_parent
 from pyams_utils.url import absolute_url
 from pyams_viewlet.viewlet import viewlet_config
-from pyams_zmi.form import InnerAdminDisplayForm
+from pyams_zmi.form import InnerAdminDisplayForm, AdminDialogDisplayForm
 from pyams_zmi.view import ContainerAdminView
 from pyramid.decorator import reify
 from pyramid.exceptions import NotFound
@@ -63,9 +63,11 @@
                 'message': self.request.localizer.translate(_("Association was correctly added.")),
                 'events': [{
                     'event': 'PyAMS_content.changed_item',
-                    'options': {'handler': 'PyAMS_content.associations.refreshAssociations',
-                                'object_name': associations_table.id,
-                                'table': associations_table.render()}
+                    'options': {
+                        'handler': 'PyAMS_content.associations.refreshAssociations',
+                        'object_name': associations_table.id,
+                        'table': associations_table.render()
+                    }
                 }]}
 
 
@@ -80,9 +82,11 @@
                 'message': self.request.localizer.translate(self.successMessage),
                 'events': [{
                     'event': 'PyAMS_content.changed_item',
-                    'options': {'handler': 'PyAMS_content.associations.refreshAssociations',
-                                'object_name': associations_table.id,
-                                'table': associations_table.render()}
+                    'options': {
+                        'handler': 'PyAMS_content.associations.refreshAssociations',
+                        'object_name': associations_table.id,
+                        'table': associations_table.render()
+                    }
                 }]}
 
 
@@ -128,7 +132,7 @@
                                'data-ams-location': absolute_url(IAssociationContainer(self.context), self.request),
                                'data-ams-tablednd-drag-handle': 'td.sorter',
                                'data-ams-tablednd-drop-target': 'set-associations-order.json'}
-        attributes.setdefault('tr', {}).setdefault('data-ams-delete-target', 'delete-association.json');
+        attributes.setdefault('tr', {}).setdefault('data-ams-delete-target', 'delete-association.json')
         return attributes
 
     @reify
@@ -307,6 +311,19 @@
     table_class = AssociationsTable
 
 
+@pagelet_config(name='associations-dialog.html', context=IAssociationTarget, layer=IPyAMSLayer,
+                permission=VIEW_SYSTEM_PERMISSION)
+@implementer(IAssociationsParentForm)
+class AssociationsContainerDialogView(AdminDialogDisplayForm):
+    """Associations dialog view"""
+
+    title = _("Associations list")
+    dialog_class = 'modal-large no-widget-toolbar'
+    fieldset_class = 'height-300'
+
+    fields = field.Fields(Interface)
+
+
 @adapter_config(name='associations', context=(IAssociationTarget, IPyAMSLayer, IAssociationsParentForm),
                 provides=IInnerSubForm)
 @template_config(template='templates/associations.pt', layer=IPyAMSLayer)