Remove header paragraph add menu and form
authorThierry Florac <thierry.florac@onf.fr>
Mon, 27 Aug 2018 11:49:21 +0200
changeset 890 316eb15688bd
parent 889 16a39f306f05
child 891 f69af721c84b
Remove header paragraph add menu and form
src/pyams_content/component/paragraph/zmi/header.py
--- a/src/pyams_content/component/paragraph/zmi/header.py	Mon Aug 27 11:47:59 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/header.py	Mon Aug 27 11:49:21 2018 +0200
@@ -16,68 +16,27 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer
-from pyams_content.component.paragraph.interfaces.header import IHeaderParagraph, HEADER_PARAGRAPH_TYPE
-from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
+from pyams_content.component.paragraph.interfaces.header import IHeaderParagraph
+from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_form.interfaces.form import IInnerForm
-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.paragraph.header import HeaderParagraph
-from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event, IParagraphEditFormButtons
+from pyams_content.component.paragraph.zmi import BaseParagraphAJAXEditForm, \
+    BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event, IParagraphEditFormButtons
 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_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 _
 
 
-@viewlet_config(name='add-header-paragraph.menu', context=IParagraphContainerTarget, view=IParagraphContainerView,
-                layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=40)
-class HeaderParagraphAddMenu(BaseParagraphAddMenu):
-    """Header paragraph add menu"""
-
-    label = _("Header...")
-    label_css_class = 'fa fa-fw fa-download fa-rotate-180'
-    url = 'add-header-paragraph.html'
-    paragraph_type = HEADER_PARAGRAPH_TYPE
-
-
-@pagelet_config(name='add-header-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
-                permission=MANAGE_CONTENT_PERMISSION)
-@ajax_config(name='add-header-paragraph.json', context=IParagraphContainerTarget, layer=IPyAMSLayer,
-             base=BaseParagraphAJAXAddForm)
-class HeaderParagraphAddForm(AdminDialogAddForm):
-    """Header paragraph add form"""
-
-    legend = _("Add new header paragraph")
-    icon_css_class = 'fa fa-fw fa-download fa-rotate-180'
-
-    fields = field.Fields(IHeaderParagraph).select('header', 'renderer')
-    edit_permission = MANAGE_CONTENT_PERMISSION
-
-    def updateWidgets(self, prefix=None):
-        super(HeaderParagraphAddForm, self).updateWidgets(prefix)
-        if 'header' in self.widgets:
-            self.widgets['header'].widget_css_class = 'input height-100'
-
-    def create(self, data):
-        return HeaderParagraph()
-
-    def add(self, object):
-        IParagraphContainer(self.context).append(object)
-
-
 @pagelet_config(name='properties.html', context=IHeaderParagraph, layer=IPyAMSLayer,
                 permission=MANAGE_CONTENT_PERMISSION)
 @ajax_config(name='properties.json', context=IHeaderParagraph, layer=IPyAMSLayer,