# HG changeset patch # User Thierry Florac # Date 1535356775 -7200 # Node ID 71863b99d12ce9e5bb3c04e47b9b6c56d61f8619 # Parent 9fc99ca5c9bc3d9dbdb24571c433adde97bd4dac Added "ajax_config" decorator to properties edit form diff -r 9fc99ca5c9bc -r 71863b99d12c src/pyams_zmi/zmi/site.py --- a/src/pyams_zmi/zmi/site.py Fri Jul 20 12:49:02 2018 +0200 +++ b/src/pyams_zmi/zmi/site.py Mon Aug 27 09:59:35 2018 +0200 @@ -27,7 +27,7 @@ from pyams_zmi.layer import IAdminLayer # import packages -from pyams_form.form import AJAXEditForm +from pyams_form.form import AJAXEditForm, ajax_config from pyams_pagelet.pagelet import pagelet_config from pyams_skin.page import DefaultPageHeaderAdapter from pyams_skin.viewlet.menu import MenuItem @@ -69,6 +69,7 @@ @pagelet_config(name='properties.html', context=ISiteRoot, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION) +@ajax_config(name='properties.json', context=ISiteRoot, layer=IPyAMSLayer) @implementer(IWidgetForm, IInnerPage, IPropertiesEditForm) class PropertiesEditForm(AdminEditForm): """Properties edit form""" @@ -91,12 +92,6 @@ def getContent(self): return IConfiguration(self.context) - -@view_config(name='properties.json', context=ISiteRoot, request_type=IPyAMSLayer, - permission=MANAGE_SYSTEM_PERMISSION, renderer='json', xhr=True) -class PropertiesAJAXEditForm(AJAXEditForm, PropertiesEditForm): - """Properties edit form, AJAX renderer""" - def get_ajax_output(self, changes): if changes: return { @@ -106,7 +101,7 @@ 'smallbox_status': 'success' } else: - return AJAXEditForm.get_ajax_output(self, changes) + return super(self.__class__, self).get_ajax_output(changes) @adapter_config(context=(Interface, IPyAMSLayer, PropertiesEditForm), provides=IPageHeader)