Use base AJAX pagraph add form
authorThierry Florac <thierry.florac@onf.fr>
Tue, 12 Sep 2017 16:42:36 +0200
changeset 150 90a1cb45caf8
parent 149 128e447b6a7f
child 151 890d3c1e0c71
Use base AJAX pagraph add form
src/pyams_content/component/illustration/zmi/paragraph.py
--- a/src/pyams_content/component/illustration/zmi/paragraph.py	Tue Sep 12 16:42:12 2017 +0200
+++ b/src/pyams_content/component/illustration/zmi/paragraph.py	Tue Sep 12 16:42:36 2017 +0200
@@ -31,9 +31,8 @@
 
 # import packages
 from pyams_content.component.illustration.paragraph import Illustration
-from pyams_content.component.paragraph.zmi import BaseParagraphAJAXEditForm
+from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm
 from pyams_content.component.paragraph.zmi.container import ParagraphContainerView
-from pyams_form.form import AJAXAddForm
 from pyams_form.security import ProtectedFormObjectMixin
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.viewlet.toolbar import ToolbarMenuItem
@@ -90,13 +89,9 @@
 
 @view_config(name='add-illustration.json', context=IParagraphContainerTarget, request_type=IPyAMSLayer,
              permission=MANAGE_CONTENT_PERMISSION, renderer='json', xhr=True)
-class IllustrationAJAXAddForm(AJAXAddForm, IllustrationAddForm):
+class IllustrationAJAXAddForm(BaseParagraphAJAXAddForm, IllustrationAddForm):
     """HTML paragraph add form, JSON renderer"""
 
-    def get_ajax_output(self, changes):
-        return {'status': 'reload',
-                'location': '#paragraphs.html'}
-
 
 @pagelet_config(name='properties.html', context=IIllustrationParagraph, layer=IPyAMSLayer,
                 permission=MANAGE_CONTENT_PERMISSION)