Skip to content

Commit

Permalink
ingredients templates
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanegigandet committed Oct 15, 2024
1 parent 5a3a5d0 commit dbb3330
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"level": "info",
"topics": [
"health"
],
"size": "small",
[% IF panel.ingredient_description OR panel.wikipedia_abstract %]
"expanded": false,
[% ELSE %]
"expanded": false,
[% END %]
"title_element": {
"title": `
[% dash = "-" %]
[% dash.repeat(panel.level) %]

[% display_taxonomy_tag_name("ingredients", panel.ingredient_id) %]
[% IF panel.ingredient.percent.defined %]
([% round(panel.ingredient.percent) %]%)
[% ELSIF panel.ingredient.percent_estimate.defined %]
([% round(panel.ingredient.percent_estimate) %]% [% lang("estimate") %])
[% END %]
`,
},
"elements": [
[% IF panel.ingredient_description -%]
{
"element_type": "text",
"text_element": {
"html": `[% panel.ingredient_description %]`
}
}
[% ELSIF panel.wikipedia_abstract -%]
{
"element_type": "text",
"text_element": {
"html": `<strong>[% edq(panel.wikipedia_title) %][% sep %]:</strong> [% edq(panel.wikipedia_abstract) %]`,
"source_text": `Wikipedia`,
"source_url": `[% panel.wikipedia_url %]`,
"source_lc": "[% panel.wikipedia_url_lc %]",
"source_language": "[% panel.wikipedia_url_language %]"
}
}
[% END %]
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"level": "info",
"topics": [
"health"
],
"type": "inline",
"expanded": true,
"title_element": {
"title":"[% lang("ingredient_information") %]",
},
"elements": [
[% FOREACH ingredient_panel_id IN panel.ingredients_panels_ids %]
{
"element_type": "panel",
"panel_element": {
"panel_id": "[% ingredient_panel_id %]",
}
},
[% END %]
]
}

0 comments on commit dbb3330

Please sign in to comment.