Skip to content

Commit

Permalink
feat: small improvements to ingredients and nutrition table panels (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanegigandet authored Jun 10, 2022
1 parent c7dae5c commit 154f881
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion icons/barcode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion icons/ingredients.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion icons/nutrition.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/ProductOpener/Attributes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ sub compute_attribute_ecoscore($$$) {
# Eco-Score is not-applicable
elsif ((defined $product_ref->{ecoscore_grade}) and ($product_ref->{ecoscore_grade} eq "not-applicable")) {
$attribute_ref->{status} = "unknown";
$attribute_ref->{icon_url} = "$static_subdomain/images/attributes/ecoscore-unknown.svg";
$attribute_ref->{icon_url} = "$static_subdomain/images/attributes/ecoscore-not-applicable.svg";
$attribute_ref->{match} = 0;
if ($target_lc ne "data") {
$attribute_ref->{title} = lang_in_other_lc($target_lc, "attribute_ecoscore_not_applicable_title");
Expand Down
19 changes: 9 additions & 10 deletions lib/ProductOpener/Display.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2162,19 +2162,18 @@ sub display_list_of_tags($$) {
$display = "<img src=\"/images/attributes/nutriscore-$tagid.svg\" alt=\"$Lang{nutrition_grade_fr_alt}{$lc} " .$grade . "\" title=\"$Lang{nutrition_grade_fr_alt}{$lc} " . $grade . "\" style=\"max-height:80px;\">" ;
}
elsif ($tagtype eq 'ecoscore') {
if ($tagid ne "not-applicable") {
my $grade;
if ($tagid =~ /^[abcde]$/) {
$grade = uc($tagid);
}
else {
$grade = lang("unknown");
}
$display = "<img src=\"/images/attributes/ecoscore-$tagid.svg\" alt=\"$Lang{ecoscore}{$lc} " . $grade . "\" title=\"$Lang{ecoscore}{$lc} " . $grade . "\" style=\"max-height:80px;\">" ;
my $grade;

if ($tagid =~ /^[abcde]$/) {
$grade = uc($tagid);
}
elsif ($tagid eq "not-applicable") {
$grade = lang("not_applicable");
}
else {
$display = lang("not_applicable");
$grade = lang("unknown");
}
$display = "<img src=\"/images/attributes/ecoscore-$tagid.svg\" alt=\"$Lang{ecoscore}{$lc} " . $grade . "\" title=\"$Lang{ecoscore}{$lc} " . $grade . "\" style=\"max-height:80px;\">" ;
}
elsif ($tagtype eq 'nova_groups') {
if ($tagid =~ /^en:(1|2|3|4)/) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"environment"
],
"title_element": {
"icon_url": "[% static_subdomain %]/images/attributes/ecoscore-unknown.svg",
"icon_url": "[% static_subdomain %]/images/attributes/ecoscore-not-applicable.svg",
"title": "[% lang("attribute_ecoscore_not_applicable_title") %]",
"subtitle": "[% panel.subtitle %]",
"type": "grade",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
],
"expanded": false,
"expand_for": "large",
"evaluation": "unknown",
"title_element": {
"title":"[% panel.title %]",
"icon_url": "[% static_subdomain %]/images/icons/dist/ingredients.svg",
"icon_color_from_evaluation": true,
},
"elements": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
],
"expanded": false,
"expand_for": "large",
"evaluation": "unknown",
"title_element": {
"title": "[% lang('nutrition_data_table') %]",
"icon_url": "[% static_subdomain %]/images/icons/dist/nutrition.svg",
"icon_color_from_evaluation": true,
},
"elements": [
{
Expand Down

0 comments on commit 154f881

Please sign in to comment.