From eb0a61a4cfcd04355401e13fff99e1ac9e460de2 Mon Sep 17 00:00:00 2001 From: Brandon Mercier <113701731+bram-odoo@users.noreply.github.com> Date: Mon, 31 Mar 2025 17:03:42 +0200 Subject: [PATCH] [IMP] howto/website_themes: Building blocks page update - Change the Github urls to the correct version of Odoo - Adapt the way of creating a snippet template and how to add it to the builder - Add explanation about how to make a custom snippet "inner content" closes odoo/documentation#12721 Signed-off-by: Brandon Mercier (bram) --- .../howtos/website_themes/building_blocks.rst | 128 ++++++++++++++---- 1 file changed, 98 insertions(+), 30 deletions(-) diff --git a/content/developer/howtos/website_themes/building_blocks.rst b/content/developer/howtos/website_themes/building_blocks.rst index 940eb8bd7..ef55192b1 100644 --- a/content/developer/howtos/website_themes/building_blocks.rst +++ b/content/developer/howtos/website_themes/building_blocks.rst @@ -5,12 +5,12 @@ Building blocks Building blocks, also known as snippets, are how users design and layout pages. They are important XML elements of your design. -The building blocks are classified into four categories: +The building blocks are classified into two types: -#. **Structure blocks**: to give a basic structure to the website -#. **Feature blocks**: to describe the features of a product or service -#. **Dynamic Content blocks**: blocks that are animated or interact with the backend -#. **Inner Content blocks**: blocks used inside other building blocks +#. **Structure blocks**: visually used as "whole rows" and distributed into multiples categories + (:guilabel:`Intro`, :guilabel:`Columns`, :guilabel:`Content`, :guilabel:`Images`, + :guilabel:`People`, etc) +#. **Inner Content blocks**: used inside other building blocks At the end of this chapter, you will be able to :ref:`create custom snippets ` and to add them into a dedicated category. @@ -427,15 +427,21 @@ snippet (e.g., :file:`001.js`, :file:`002.scss`). Custom snippet ============== -To create a custom snippet, create first the snippet template. Then, add it to the list and make it -available via the Website Builder. +Some more specific needs will require the creation of custom snippets. Here is how to create a +custom snippet/ .. _website_themes/building_blocks/custom/template: Template -------- -**Declaration** +Create first the snippet template. Then, add it to the list and make it available via the Website +Builder. + +1. Declaration +~~~~~~~~~~~~~~ + +First, create the template of the custom snippet: .. code-block:: xml :caption: ``/website_airproof/views/snippets/s_airproof_snippet.xml`` @@ -464,25 +470,63 @@ Template - Avoid using ID attribute within your `section` as several instances of a snippet may appear throughout the page (An ID attribute has to be unique on a page). -Add your custom snippet to the list of standard snippets, so the user can drag and drop it on the +Add the custom snippet to the list of standard snippets, so the user can drag and drop it on the page, directly from the edit panel. +2. Group creation +~~~~~~~~~~~~~~~~~ + +Add a group at the top of the list (feel free to the put it where needed in this list). + .. code-block:: xml :caption: ``/website_airproof/views/snippets/options.xml`` - +.. _website_themes/building_blocks/custom/options/inner_content: + **Inner content** Make a custom snippet "inner content" (droppable in an other building block) by extending the @@ -570,7 +638,7 @@ inner content building blocks: .. seealso:: - `Standard "inner content" snippets declaration on Odoo's GitHub repository `_ + `Standard "inner content" snippets declaration on Odoo's GitHub repository `_ .. _website_themes/building_blocks/custom/options/binding: @@ -949,9 +1017,9 @@ There are also built-in methods directly linked to events the Website Builder li .. seealso:: - `Web Editor - JavaScript methods related to snippet options on GitHub - `_ - - `XML templates of the different snippets - `_ + `_ + - `XML templates of the different standard snippets + `_ .. _website_themes/building_blocks/custom/options/methods/custom: