diff -r 3599d25c7f10 -r 837612af4dc3 src/pyams_content/component/association/zmi/paragraph.py --- a/src/pyams_content/component/association/zmi/paragraph.py Thu Jan 17 12:41:14 2019 +0100 +++ b/src/pyams_content/component/association/zmi/paragraph.py Thu Jan 17 16:42:32 2019 +0100 @@ -12,36 +12,28 @@ __docformat__ = 'restructuredtext' - -# import standard library +from z3c.form import button +from z3c.form.interfaces import INPUT_MODE +from zope.interface import implementer -# import interfaces -from pyams_content.component.association.interfaces import IAssociationParagraph, ASSOCIATION_PARAGRAPH_TYPE +from pyams_content.component.association.interfaces import ASSOCIATION_PARAGRAPH_TYPE, IAssociationParagraph from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm -from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer -from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView +from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget +from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \ + BaseParagraphAddForm, BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, IParagraphInnerEditFormButtons +from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerView, IParagraphInnerEditor from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION from pyams_content.shared.common.interfaces import IWfSharedContent +from pyams_form.form import ajax_config from pyams_form.interfaces.form import IInnerForm from pyams_i18n.interfaces import II18n +from pyams_pagelet.pagelet import pagelet_config +from pyams_skin.event import get_json_widget_refresh_event from pyams_skin.interfaces.viewlet import IToolbarAddingMenu from pyams_skin.layer import IPyAMSLayer -from z3c.form.interfaces import INPUT_MODE - -# import packages -from pyams_content.component.association.paragraph import AssociationParagraph -from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \ - BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, IParagraphEditFormButtons, IParagraphInnerEditFormButtons -from pyams_content.features.renderer.zmi.widget import RendererFieldWidget -from pyams_form.form import ajax_config -from pyams_pagelet.pagelet import pagelet_config -from pyams_skin.event import get_json_widget_refresh_event from pyams_utils.adapter import adapter_config from pyams_utils.traversing import get_parent from pyams_viewlet.viewlet import viewlet_config -from pyams_zmi.form import AdminDialogAddForm -from z3c.form import field, button -from zope.interface import implementer from pyams_content import _ @@ -61,20 +53,12 @@ permission=MANAGE_CONTENT_PERMISSION) @ajax_config(name='add-association-paragraph.json', context=IParagraphContainerTarget, layer=IPyAMSLayer, base=BaseParagraphAJAXAddForm) -class AssociationParagraphAddForm(AdminDialogAddForm): +class AssociationParagraphAddForm(BaseParagraphAddForm): """Association paragraph add form""" legend = _("Add new association paragraph") - icon_css_class = 'fa fa-fw fa-link' - fields = field.Fields(IAssociationParagraph).select('title', 'renderer') - edit_permission = MANAGE_CONTENT_PERMISSION - - def create(self, data): - return AssociationParagraph() - - def add(self, object): - IParagraphContainer(self.context).append(object) + content_interface = IAssociationParagraph @pagelet_config(name='properties.html', context=IAssociationParagraph, layer=IPyAMSLayer, @@ -91,12 +75,8 @@ return II18n(content).query_attribute('title', request=self.request) legend = _("Edit association paragraph properties") - icon_css_class = 'fa fa-fw fa-link' - fields = field.Fields(IAssociationParagraph).select('title', 'renderer') - fields['renderer'].widgetFactory = RendererFieldWidget - - edit_permission = MANAGE_CONTENT_PERMISSION + content_interface = IAssociationParagraph def get_ajax_output(self, changes): output = super(self.__class__, self).get_ajax_output(changes)