-
-
Notifications
You must be signed in to change notification settings - Fork 406
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: add link to learn more about nutriscore + ecoscore #6701
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
LGTM but a style comment !
"element_type": "text", | ||
"text_element": { | ||
"html": ` | ||
<p>→ <a href="/nutriscore">[% lang('nutriscore_learn_more') %]</a></p> |
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.
Why not url_for_text("nutriscore")
here ?
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.
url_for_text() currently only works for the Eco-Score text, the /nutriscore text URL is not localized, it's the same for all languages.
=head2 url_for_text ( $textid )
Return the localized URL for a text. (e.g. "data" points to /data in English and /donnees in French)
=cut
# Note: the following urls are currently hardcoded, but the idea is to build the mapping table
# at startup from the available translated texts in the repository. (TODO)
my %urls_for_texts = (
"ecoscore" => {
en => "eco-score-the-environmental-impact-of-food-products",
de => "eco-score-die-umweltauswirkungen-von-lebensmitteln",
es => "eco-score-el-impacto-medioambiental-de-los-productos-alimenticios",
fr => "eco-score-l-impact-environnemental-des-produits-alimentaires",
it => "eco-score-impatto-ambientale-dei-prodotti-alimentari",
nl => "eco-score-de-milieu-impact-van-voedingsproducten",
pt => "eco-score-o-impacto-ambiental-dos-produtos-alimentares",
},
);
sub url_for_text($) {
my $textid = shift;
# remove starting / if passed
$textid =~ s/^\///;
if (not defined $urls_for_texts{$textid}) {
return "/" . $textid;
}
elsif (defined $urls_for_texts{$textid}{$lc}) {
return "/" . $urls_for_texts{$textid}{$lc};
}
elsif ($urls_for_texts{$textid}{en}) {
return "/" . $urls_for_texts{$textid}{en};
}
else {
return "/" . $textid;
}
}
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.
What's happening to the existing NOVA link ?
Nothing is happening, it's kept as-is. This PR adds a similar "Learn more about... " link in the Nutri-Score and Eco-Score panels. |
Can we close this? |
@stephanegigandet I can't see it in Smoothie. Has it been deployed ? Do we need tweaking client side ? |
fixes #6689
related to #6679