Use base paragraph edit forms
authorThierry Florac <thierry.florac@onf.fr>
Fri, 10 Nov 2017 11:53:18 +0100
changeset 251 6328755f08a5
parent 250 104e2c370c76
child 252 2dafc720b378
Use base paragraph edit forms
src/pyams_content/component/illustration/zmi/paragraph.py
--- a/src/pyams_content/component/illustration/zmi/paragraph.py	Fri Nov 10 11:52:51 2017 +0100
+++ b/src/pyams_content/component/illustration/zmi/paragraph.py	Fri Nov 10 11:53:18 2017 +0100
@@ -19,9 +19,8 @@
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, \
     IParagraphContainer, IParagraphSummary
 from pyams_content.component.illustration.interfaces import IIllustrationRenderer, IIllustration, IIllustrationParagraph
-from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor
+from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
-from pyams_content.shared.common.interfaces import IWfSharedContent
 from pyams_form.interfaces.form import IInnerForm, IEditFormButtons
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
@@ -32,13 +31,11 @@
 # import packages
 from pyams_content.component.illustration.paragraph import Illustration
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu
-from pyams_content.component.paragraph.zmi.container import ParagraphContainerView
+    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_utils.adapter import adapter_config
-from pyams_utils.traversing import get_parent
 from pyams_viewlet.viewlet import viewlet_config, BaseContentProvider
-from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
+from pyams_zmi.form import AdminDialogAddForm
 from pyramid.view import view_config
 from z3c.form import field, button
 from zope.interface import implementer
@@ -50,7 +47,7 @@
 # Illustration
 #
 
-@viewlet_config(name='add-illustration.menu', context=IParagraphContainerTarget, view=ParagraphContainerView,
+@viewlet_config(name='add-illustration.menu', context=IParagraphContainerTarget, view=IParagraphContainerView,
                 layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=60)
 class IllustrationAddMenu(BaseParagraphAddMenu):
     """Illustration add menu"""
@@ -94,14 +91,9 @@
 
 @pagelet_config(name='properties.html', context=IIllustrationParagraph, layer=IPyAMSLayer,
                 permission=MANAGE_CONTENT_PERMISSION)
-class IllustrationPropertiesEditForm(AdminDialogEditForm):
+class IllustrationPropertiesEditForm(BaseParagraphPropertiesEditForm):
     """Illustration properties edit form"""
 
-    @property
-    def title(self):
-        content = get_parent(self.context, IWfSharedContent)
-        return II18n(content).query_attribute('title', request=self.request)
-
     legend = _("Edit illustration properties")
     dialog_class = 'modal-large'
     icon_css_class = 'fa fa-fw fa-file-image-o'