diff --git a/docs/components/PLACEHOLDERS.md b/docs/components/PLACEHOLDERS.md index cb1ccff5aa..c4ae0367d1 100644 --- a/docs/components/PLACEHOLDERS.md +++ b/docs/components/PLACEHOLDERS.md @@ -14,8 +14,7 @@ The component only has 1 input and supports a *content value*. ## How it works -Based on the **id** provided to the placeholder component, it will register itself to the event coming from * -*placeholderTemplate** and will display the template corresponding to its ID in the store. +Based on the **id** provided to the placeholder component, it will register itself to the event coming from **placeholderTemplate** and will display the template corresponding to its ID in the store. > [!IMPORTANT] > It is **strongly encouraged** to use the placeholder mechanism in concert with @@ -23,8 +22,7 @@ Based on the **id** provided to the placeholder component, it will register itse ## How to define a placeholder template -The placeholder template is defined in a JSON file following this JSON -Schema [placeholder-template.schema.json](../../packages/@o3r/components/schemas/placeholder-template.schema.json). +The placeholder template is defined in a JSON file following the [JSON Schema](https://json-schema.org/) defined in [placeholder-template.schema.json](https://github.com/AmadeusITGroup/otter/blob/main/packages/%40o3r/components/schemas/placeholder-template.schema.json). Example: @@ -33,7 +31,7 @@ Example: "template": "
My fact : <%= myFact %>
", "vars": { "myFact ": { - "value": "myFact ", + "value": "myFact", "type": "fact" } } diff --git a/docs/rules-engine/how-it-works/placeholders.md b/docs/rules-engine/how-it-works/placeholders.md index d2d4c43238..a9c71c8417 100644 --- a/docs/rules-engine/how-it-works/placeholders.md +++ b/docs/rules-engine/how-it-works/placeholders.md @@ -1,18 +1,19 @@ # Placeholders ## Localization -When a placeholder content is created using the CMS, it provides the default language in assets folder : placeholders/my-placeholder-content-name/master.json +When a placeholder content is created using the CMS, it provides the default language in assets folder: placeholders/my-placeholder-content-name/master.json Then for each new locale that you want to support, you will have to create the associated placeholder that will be automatically added to placeholders/my-placeholder-content-name/[LANG]/name.json. -For more information about experience fragments, please check: [Experience fragment](https://dev.azure.com/AmadeusDigitalAirline/DES%20Platform/_wiki/wikis/DES%20Documentation/1964/Experience-Fragments-in-DES) +For more information about experience fragments, please check: [Experience fragment](https://dev.azure.com/AmadeusDigitalAirline/DES%20Platform/_wiki/wikis/DES%20Documentation/1964/Experience-Fragments-in-DES). + The dynamic part of the URL is replaced by the locale, and each locale change triggers a new call that will retrieve the associated localized template. ## Format of the placeholder file -The placeholder file that will be sent by the cms is a json that contains both the html template and the variables that will be replaced +The placeholder file that will be sent by the CMS is a JSON file that contains both the HTML template and the variables that will be replaced. -example : +example: ```json { "vars": { @@ -29,14 +30,14 @@ example : } ``` -As of today, three different types of vars are supported : -* relativeUrl : Path to a resource from the dynamicContent (more info at [Dynamic Content](../../dynamic-content/DYNAMIC_CONTENT.md)), the mediaPath will be used to create the full path -* fact : reference to a fact, that will be replaced and plugged to the fact streams (When a fact that is referenced by the template changes, it triggers a refresh) -* fullUrl : simple replace will be performed for this one +As of today, three different types of variables are supported: +* `relativeUrl`: Path to a resource from the dynamicContent (more info at [Dynamic Content](../../dynamic-content/DYNAMIC_CONTENT.md)), the mediaPath will be used to create the full path +* `fact`: reference to a fact, that will be replaced and plugged to the fact streams (when a fact that is referenced by the template changes, it triggers a refresh) +* `fullUrl`: simple replace will be performed for this one ## Technical details -Placeholders added to the application or library requires a [metadata file](../how-to-use/integration.md), that will be merged in the component metadata file by the cms-adapter and sent to the cms. -Placeholder contents are created using the admin UI and associated to a placeholder via a rules engine action : +Placeholders added to the application or library requires a [metadata file](../how-to-use/integration.md), that will be merged in the component metadata file by the cms-adapter and sent to the CMS. +Placeholder contents are created using the admin UI and associated to a placeholder via a rules engine action: ```json { "elementType": "ACTION", @@ -45,5 +46,5 @@ Placeholder contents are created using the admin UI and associated to a placehol "placeholderId": "pl2358lv-2c63-42e1-b450-6aafd91fbae8" } ``` -The service processes the action, and set the url of the template in the store. The call to retrieve the associated template is processed, the template rendered and the result is added in the store. +The service processes the action, and set the URL of the template in the store. The call to retrieve the associated template is processed, the template rendered and the result is added in the store. Each change facts referenced in the template will trigger a new render, and each language change will trigger a new call to get the associated template (except if the content is not localized). diff --git a/docs/rules-engine/how-to-use/placeholders.md b/docs/rules-engine/how-to-use/placeholders.md index b29d81789d..486215fca7 100644 --- a/docs/rules-engine/how-to-use/placeholders.md +++ b/docs/rules-engine/how-to-use/placeholders.md @@ -21,16 +21,15 @@ import {PlaceholderModule} from '@o3r/components'; export class SearchModule {} ``` -Then add the placeholder in your html with a unique id -```typescript -... +Then add the placeholder in your HTML with a unique id +```html