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

fix: add more linked panels for attributes #6808

Merged
merged 12 commits into from
May 30, 2023
7 changes: 5 additions & 2 deletions lib/ProductOpener/Attributes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ sub initialize_attribute ($attribute_id, $target_lc) {
my $allergen = $1;
$allergen =~ s/_/-/g;
$attribute_ref->{icon_url} = "$static_subdomain/images/attributes/no-$allergen.svg";
# There is currently no knowledge panel related to allergens
# $attribute_ref->{panel_id} = "$allergen";
}
elsif ($attribute_id =~ /^(low)_(salt|sugars|fat|saturated_fat)$/) {
my $nid = $2;
Expand All @@ -299,13 +301,14 @@ sub initialize_attribute ($attribute_id, $target_lc) {
my $analysis_tag = $attribute_id;
$analysis_tag =~ s/_/-/g;
$attribute_ref->{icon_url} = "$static_subdomain/images/attributes/$analysis_tag.svg";
$attribute_ref->{panel_id} = "ingredients_analysis_en:" . $analysis_tag;
}
elsif ($attribute_id =~ /^(labels)_(.*)$/) {
my $tagtype = $1;
my $tag = $2;
$tag =~ s/_/-/g;

$attribute_ref->{icon_url} = "$static_subdomain/images/attributes/${tag}.svg";
$attribute_ref->{panel_id} = "${tag}";
Copy link
Member

Choose a reason for hiding this comment

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

There is "environment_label_en:" in front. And we should do this only for tags with a panel (how do we get them ? Is it through a property in taxonomy ?)

Copy link
Member Author

Choose a reason for hiding this comment

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

@alexgarel would removing this change for the labels make the PR acceptable to you ? we indeed don't have any knowledge panels on labels, but that would be another issue that we can create

teolemon marked this conversation as resolved.
Show resolved Hide resolved
}

# Initialize name and setting name if a language is requested
Expand Down Expand Up @@ -336,7 +339,7 @@ sub initialize_attribute ($attribute_id, $target_lc) {
my $name = display_taxonomy_tag($target_lc, "ingredients_analysis", "en:$analysis_tag");
$attribute_ref->{name} = $name;
$attribute_ref->{setting_name} = $name;

$attribute_ref->{panel_id} = "ingredients_analysis_en:" . $analysis_tag;
}

# Nutrient levels
Expand Down