Skip to content

Commit

Permalink
doc(bazar-fields)
Browse files Browse the repository at this point in the history
  • Loading branch information
seballot committed Jan 19, 2025
1 parent cdaae17 commit cbf33d4
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions docs/en/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Old school templates might be easier to write, but dynamic templates will provid
Create a file inside `custom/templates/bazar`, either a `.twig` file or a `.tpl.html`

```twig
<!-- custom/templates/bazar/my-template.twig -->
{# custom/templates/bazar/my-template.twig #}
{% for fiche in fiches %}
<div>{{ fiche.bf_titre }}</div>
{% endfor %}
Expand All @@ -60,7 +60,7 @@ example : 'AB_filename_label' => 'Template custom annuaire',
Create a file inside `custom/templates/bazar/entries/index-dynamic-templates/`

```twig
<!-- custom/templates/bazar/entries/index-dynamic-templates/my-template.twig -->
{# custom/templates/bazar/entries/index-dynamic-templates/my-template.twig #}
{% extends "@bazar/entries/index-dynamic.twig" %}
{% block display_entries %}
Expand Down Expand Up @@ -116,7 +116,6 @@ In order to optimize the request, dynamic bazalist loads by default only the min
| **Available Metadata Fields** |
| ----------------------------- |
| `owner` |
| `url` |
| `date_creation_fiche` |
| `date_maj_fiche` |
| `comments` |
Expand All @@ -125,12 +124,26 @@ In order to optimize the request, dynamic bazalist loads by default only the min
| `reactions_count` |
| `triples` |

##### Debuging

Tip: You can display the currently loaded data with `<pre v-html="entry"></pre>`

```twig
{% extends "@bazar/entries/index-dynamic.twig" %}
{% block display_entries %}
<div v-for="entry in entriesToDisplay">
<pre v-html="entry"></pre>
</div>
{% endblock %}
```

##### Override existing template

Existing yeswiki templates contains block declaration so you can easily override specific parts, for example

```twig
<!-- custom/templates/bazar/entries/index-dynamic-templates/my-template.twig -->
{# custom/templates/bazar/entries/index-dynamic-templates/my-template.twig #}
{% extends "@bazar/entries/index-dynamic-templates/card.twig" %}
{% block area_footer %}
Expand All @@ -150,7 +163,7 @@ See the code of [existing templates](https://github.com/YesWiki/yeswiki/tree/dor
You can also include dedicated Vue components, in order to introduce your own VueJs javascript code.

```twig
<!-- custom/templates/bazar/entries/index-dynamic-templates/my-template.twig -->
{# custom/templates/bazar/entries/index-dynamic-templates/my-template.twig #}
{% extends "@bazar/entries/index-dynamic.twig" %}
{% block assets %}
Expand All @@ -163,7 +176,7 @@ You can also include dedicated Vue components, in order to introduce your own Vu
```

```js
<!-- custom/javascripts/bazar/DemoComponent.js -->
// custom/javascripts/bazar/DemoComponent.js
Vue.component('DemoComponent', {
props: ['entry'],
computed: {
Expand Down

0 comments on commit cbf33d4

Please sign in to comment.