-
-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ingredients knowledge panels #10904
Draft
stephanegigandet
wants to merge
23
commits into
main
Choose a base branch
from
ingredients-panels
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
5a3a5d0
feat: ingredients knowledge panels
stephanegigandet dbb3330
ingredients templates
stephanegigandet c81a152
fixes for mobile app
stephanegigandet 2eccff5
test: Update tests results
bfc4513
double backticks
stephanegigandet 99c52e4
update tests
stephanegigandet fc47017
panels without content cannot be expanded
stephanegigandet 47dc289
panels without content cannot be expanded
stephanegigandet e6c7ad6
Update lib/ProductOpener/KnowledgePanelsIngredients.pm
stephanegigandet 98b62b4
Update lib/ProductOpener/KnowledgePanelsIngredients.pm
stephanegigandet 8c18816
fix template
stephanegigandet 972b015
< 2%
stephanegigandet c504614
< 2%
stephanegigandet e2e7427
< 2%
stephanegigandet b26162f
merged
stephanegigandet 8fbe28f
lint
stephanegigandet 2a9cdf6
test: Update tests results
e14a930
taxonomy: fix duplicate Poire Guyot
alexgarel 9a977c1
fixed conflicts
stephanegigandet 2f4140e
Merge branch 'ingredients-panels' of github.com:openfoodfacts/openfoo…
stephanegigandet 9f52cae
Merge branch 'main' into ingredients-panels
stephanegigandet c8cbfb9
Merge branch 'main' into ingredients-panels
stephanegigandet 9785ef2
test: Update tests results
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,24 +4,33 @@ | |
"health" | ||
], | ||
"size": "small", | ||
[% IF panel.ingredient_description OR panel.wikipedia_abstract %] | ||
"expanded": false, | ||
[% ELSE %] | ||
"expanded": false, | ||
[% END %] | ||
"title_element": { | ||
// Note: the app displays line feeds as line feeds... | ||
"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 %] `, | ||
// double backticks: convert to a single line without newlines and extra spaces | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😲 cool ! |
||
"title": `` | ||
[% dash = "—" %] | ||
[% dash.repeat(panel.level) %] | ||
|
||
[% display_taxonomy_tag_name("ingredients", panel.ingredient_id) %][% sep %]: | ||
[% IF panel.ingredient.percent.defined %] | ||
[% sprintf("%.1f", panel.ingredient.percent) %]% | ||
[% ELSIF panel.ingredient.percent_estimate.defined %] | ||
[% IF panel.ingredient.percent_estimate < 2 %] | ||
< 2% ([% lang("estimate") %]) | ||
[% ELSE %] | ||
[% sprintf("%.1f", panel.ingredient.percent_estimate) %]% ([% lang("estimate") %]) | ||
[% END %] | ||
[% END %] | ||
``, | ||
}, | ||
"elements": [ | ||
[% IF panel.ingredient_description -%] | ||
[% IF panel.ingredient_description %] | ||
{ | ||
"element_type": "text", | ||
"text_element": { | ||
"html": `[% panel.ingredient_description %]` | ||
alexgarel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
[% ELSIF panel.wikipedia_abstract -%] | ||
[% ELSIF panel.wikipedia_abstract %] | ||
{ | ||
"element_type": "text", | ||
"text_element": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea :-)