src/source/howto-paragraph.rst
branchdoc-dc
changeset 83 ee94d17857a4
parent 78 88a65b19d07d
child 84 8eb1b401003a
--- a/src/source/howto-paragraph.rst	Tue Jun 05 12:05:59 2018 +0200
+++ b/src/source/howto-paragraph.rst	Tue Jun 05 15:10:27 2018 +0200
@@ -1,8 +1,8 @@
 .. _paragraphhowto:
 
 
-How to create a new Paragraph type?
-===================================
+How to create a Paragraph type?
+===============================
 
 Paragraphs are components or blocs that contain elements/fields and provide one or many renderer methods to compose
 the front office website
@@ -160,43 +160,10 @@
         paragraph_type = CONTACT_PARAGRAPH_TYPE
 
 
+
 3) Create Edit form
 -------------------
 
-- *HTML*
-
-.. code-block:: python
-
-    @pagelet_config(name='properties.html', context=IContactParagraph, layer=IPyAMSLayer,
-                    permission=MANAGE_CONTENT_PERMISSION)
-    class ContactPhoneParagraphPropertiesEditForm(BaseParagraphPropertiesEditForm):
-        """Contact phone paragraph properties edit form"""
-
-        prefix = 'contact_properties.'
-
-        legend = _("Edit contact card properties")
-        icon_css_class = 'fa fa-fw fa-id-card-o'
-
-        fields = field.Fields(IContactParagraph).omit('__parent__', '__name__', 'visible')
-        fields['renderer'].widgetFactory = RendererFieldWidget
-
-        ajax_handler = 'properties.json'
-        edit_permission = MANAGE_CONTENT_PERMISSION
-
-
-- *JSON*
-
-.. code-block:: python
-
-    @view_config(name='properties.json', context=IContactPhoneParagraph, request_type=IPyAMSLayer,
-                 permission=MANAGE_CONTENT_PERMISSION, renderer='json', xhr=True)
-    class ContactPhoneParagraphPropertiesAJAXEditForm(BaseParagraphAJAXEditForm, ContactParagraphPropertiesEditForm):
-        """Contact phone paragraph properties edit form, JSON renderer"""
-
-
-4) Create ZMI Edit form inner tab
----------------------------------
-
 .. code-block:: python
 
     @adapter_config(context=(IContactPhoneParagraph, IPyAMSLayer), provides=IParagraphInnerEditor)
@@ -237,6 +204,44 @@
                                                                                    ContactParagraphInnerEditForm))
             return output
 
+
+4) Create an Edit modal form
+-----------------------------
+
+This form is used inside modals popup
+
+
+- *HTML*
+
+.. code-block:: python
+
+    @pagelet_config(name='properties.html', context=IContactParagraph, layer=IPyAMSLayer,
+                    permission=MANAGE_CONTENT_PERMISSION)
+    class ContactPhoneParagraphPropertiesEditForm(BaseParagraphPropertiesEditForm):
+        """Contact phone paragraph properties edit form"""
+
+        prefix = 'contact_properties.'
+
+        legend = _("Edit contact card properties")
+        icon_css_class = 'fa fa-fw fa-id-card-o'
+
+        fields = field.Fields(IContactParagraph).omit('__parent__', '__name__', 'visible')
+        fields['renderer'].widgetFactory = RendererFieldWidget
+
+        ajax_handler = 'properties.json'
+        edit_permission = MANAGE_CONTENT_PERMISSION
+
+
+- *JSON*
+
+.. code-block:: python
+
+    @view_config(name='properties.json', context=IContactPhoneParagraph, request_type=IPyAMSLayer,
+                 permission=MANAGE_CONTENT_PERMISSION, renderer='json', xhr=True)
+    class ContactPhoneParagraphPropertiesAJAXEditForm(BaseParagraphAJAXEditForm, ContactParagraphPropertiesEditForm):
+        """Contact phone paragraph properties edit form, JSON renderer"""
+
+
 .. note::
 
     Select the new content block types in ZMI to make it available in tools