Skip to content

Commit

Permalink
fix: link of nutri-score knowledge panel on pro platform
Browse files Browse the repository at this point in the history
fixes: #11242
  • Loading branch information
alexgarel committed Jan 20, 2025
1 parent 7a6c11c commit 1bb6fee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/ProductOpener/Display.pm
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ BEGIN {
$images_subdomain
$static_subdomain
$producers_platform_url
$public_platform_url
$test
@lcs
$country
Expand Down Expand Up @@ -345,6 +346,7 @@ sub process_template ($template_filename, $template_data_ref, $result_content_re
$template_data_ref->{server_options_private_products} = $server_options{private_products};
$template_data_ref->{server_options_producers_platform} = $server_options{producers_platform};
$template_data_ref->{producers_platform_url} = $producers_platform_url;
$template_data_ref->{public_platform_url} = $public_platform_url;
$template_data_ref->{server_domain} = $server_domain;
$template_data_ref->{static_subdomain} = $static_subdomain;
$template_data_ref->{images_subdomain} = $images_subdomain;
Expand Down Expand Up @@ -907,11 +909,16 @@ CSS
# call format_subdomain($subdomain) only once
$formatted_subdomain = format_subdomain($subdomain);
$producers_platform_url = $formatted_subdomain . '/';
$public_platform_url = $formatted_subdomain . '/';

# If we are not already on the producers platform: add .pro
if ($producers_platform_url !~ /\.pro\.open/) {
$producers_platform_url =~ s/\.open/\.pro\.open/;
}
# and the contrary for public platform
if ($public_platform_url ~ /\.pro\.open/) {
$public_platform_url =~ s/\.pro\.open/\.open/;
}

# Enable or disable user food preferences: used to compute attributes and to display
# personalized product scores and search results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// Display the link to the new Nutri-Score computation page
// on mobile: keep the /nutriscore-v2 link until the app can handle the new URLs
"html": `
<p>&rarr; <a href="[% IF knowledge_panels_options.knowledge_panels_client == 'web' %]/new-nutriscore[% ELSE %]/nutriscore-v2[% END %]">[% lang('nutriscore_new_computation_link_text') %]</a></p>
<p>&rarr; <a href="[% public_platform_url %][% IF knowledge_panels_options.knowledge_panels_client == 'web' %]/new-nutriscore[% ELSE %]/nutriscore-v2[% END %]">[% lang('nutriscore_new_computation_link_text') %]</a></p>
`
},
},
Expand Down

0 comments on commit 1bb6fee

Please sign in to comment.