# HG changeset patch # User Thierry Florac # Date 1510311419 -3600 # Node ID 429496aab23b1c19cba14d2c1bb6f26e63a50f3a # Parent 8e2207197a9a2bed4076e89168b3e2cd5f667790 Updated JSON response diff -r 8e2207197a9a -r 429496aab23b 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)