# HG changeset patch # User Damien Correia # Date 1528204227 -7200 # Node ID ee94d17857a4e57d361388e8e035de9f2cba866f # Parent 887dbb9f54d75f7c5adadde263f40c1a5f3494ca Updated docs diff -r 887dbb9f54d7 -r ee94d17857a4 src/source/howto-paragraph.rst --- 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 diff -r 887dbb9f54d7 -r ee94d17857a4 src/source/howto-portlet.rst --- a/src/source/howto-portlet.rst Tue Jun 05 12:05:59 2018 +0200 +++ b/src/source/howto-portlet.rst Tue Jun 05 15:10:27 2018 +0200 @@ -1,8 +1,8 @@ .. _portlethowto: -How to create a new Portlet? -============================ +How to create a Portlet? +======================== **Portlets** are pluggable user interface software components that are managed and displayed in a web portal, for example an enterprise portal or a web CMS. A portlet can aggregate (integrate) and personalize content from diff -r 887dbb9f54d7 -r ee94d17857a4 src/source/howto-renderer.rst --- a/src/source/howto-renderer.rst Tue Jun 05 12:05:59 2018 +0200 +++ b/src/source/howto-renderer.rst Tue Jun 05 15:10:27 2018 +0200 @@ -1,11 +1,12 @@ .. _rendererhowto: -How to create a new Renderer? -============================= +How to create a Renderer? +========================= + **Renderer** are the layout of the utility data content. A renderer combine un context, a skin and - a template to produce the front office html +a template to produce the front office html To create new renderer you can override an already exist renderer or create a new one from scratch. Steps below we will create a renderer for a `IContact` paragraph diff -r 887dbb9f54d7 -r ee94d17857a4 src/source/howto-skin.rst --- a/src/source/howto-skin.rst Tue Jun 05 12:05:59 2018 +0200 +++ b/src/source/howto-skin.rst Tue Jun 05 15:10:27 2018 +0200 @@ -1,8 +1,8 @@ .. _skinhowto: -How to create a new skin? -========================= +How to create Skin? +=================== A Skin is a tagging interface for associating media, javascript and CSS resources to a **renderer** @@ -62,8 +62,11 @@ class CustomSkinResourcesAdapter(ContextRequestViewAdapter): """Custom skin resources adapter""" - def get_resources(self): - mycms.need() + def get_resources(self): + mycms.need() + + +We have defined a Multiadapter with context=(context, request, view). .. note:: diff -r 887dbb9f54d7 -r ee94d17857a4 src/source/howto-template.rst --- a/src/source/howto-template.rst Tue Jun 05 12:05:59 2018 +0200 +++ b/src/source/howto-template.rst Tue Jun 05 15:10:27 2018 +0200 @@ -3,3 +3,4 @@ How to create a new template? ============================= +