Skip to content
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: start of additives panels #6270

Merged
merged 6 commits into from
Jan 11, 2022
Merged

feat: start of additives panels #6270

merged 6 commits into from
Jan 11, 2022

Conversation

stephanegigandet
Copy link
Contributor

Functional:

  • list additives after the list of ingredients, as a list of small panels
  • clicking on the additive name opens the additive panel
  • additive panel currently consists only of the Wikipedia abstract and link (which are of very different levels of quality and relevance to food products depending on additive and language)
  • to be added: a list of the additive functions (colours, raising agent etc.)
  • to be added: EFSA table for the risk of overexposure (+ corresponding colors/icons in the list of additives)

Knowledge panel API changes:

  • added a size="small" property to panels, so that the list of additives doesn't take a huge amount of vertical space
  • added source_text / source_url / source_language to panel text elements

image

@stephanegigandet stephanegigandet requested a review from a team as a code owner January 10, 2022 12:58
@github-actions github-actions bot added 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org Display labels Jan 10, 2022
Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

lib/ProductOpener/KnowledgePanels.pm Show resolved Hide resolved
my $tagid = shift;

my $properties_ref = shift;
my $target_lcs_ref = shift;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there is more than 3 or 4 arguments, shouldn't we use hash to pass arguments ?

I feel like this could help make the code a bit more readable (where we call such functions).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use a hash, we lose the check on the number of arguments that Perl does at compile time. There isn't a very good way to have signatures in Perl unfortunately (there's an experimental "use experimental 'signatures';" and some modules).

Co-authored-by: Alex Garel <alex@garel.org>
@sonarcloud
Copy link

sonarcloud bot commented Jan 11, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@stephanegigandet stephanegigandet merged commit 7f9ac03 into main Jan 11, 2022
@stephanegigandet stephanegigandet deleted the additives_panel branch January 11, 2022 14:59
@teolemon teolemon mentioned this pull request Jan 27, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧪 additives Display 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants