diff --git a/cgi/user.pl b/cgi/user.pl index a5ecfb42d23c0..f9cceefce3116 100644 --- a/cgi/user.pl +++ b/cgi/user.pl @@ -166,7 +166,7 @@ $template_data_ref->{sections} = []; - if ($user_ref) { + if ($user_ref) { push @{$template_data_ref->{sections}}, { id => "user", fields => [ @@ -236,12 +236,35 @@ push @{$team_section_ref->{fields}}, { field => "team_". $i, label => sprintf(lang("team_s"), $i), - }; + }; }; push @{$template_data_ref->{sections}}, {%$team_section_ref}; } + # Contributor section + my $contributor_section_ref = { + id => "contributor_settings", + name => lang("contributor_settings") . " (" . lang("optional") . ")", + description => "contributor_settings_description", + fields => [ + { + field => "display_barcode", + type => "checkbox", + label => display_icon("barcode") . lang("display_barcode_in_search"), + value => $user_ref->{display_barcode} && "on", + }, + { + field => "edit_link", + type => "checkbox", + label => display_icon("edit") . lang("edit_link_in_search"), + value => $user_ref->{edit_link} && "on", + }, + ] + }; + + push @{$template_data_ref->{sections}}, {%$contributor_section_ref}; + # Admin section if ($admin) { my $administrator_section_ref = { diff --git a/docker/dev.yml b/docker/dev.yml index 7b2fd9f621629..859e5af93dd0a 100644 --- a/docker/dev.yml +++ b/docker/dev.yml @@ -71,6 +71,10 @@ services: USER_GID: ${USER_GID:-1000} volumes: - ./html:/opt/product-opener/html/ + - ./icons:/opt/product-opener/icons + - ./scss:/opt/product-opener/scss + - ./gulpfile.js:/opt/product-opener/ + - ./snyk:/opt/product-opener/ mongodb: # Note: keep it as close a possible to mongodb.yml image: mongo:4.4 diff --git a/html/js/product-search.js b/html/js/product-search.js index 53e8ce728499c..07cdaa0474b0c 100644 --- a/html/js/product-search.js +++ b/html/js/product-search.js @@ -140,9 +140,14 @@ function rank_products(products, product_preferences, use_user_product_preferenc } -function display_products(target, product_groups, use_user_product_preferences_for_ranking ) { +function product_edit_url(product) { + return `/cgi/product.pl?type=edit&code=${product.code}`; +} + + +function display_products(target, product_groups, user_prefs ) { - if (use_user_product_preferences_for_ranking) { + if (user_prefs.use_ranking) { $( target ).html('
" . lang("if_you_work_for_a_producer") . "
" - . "" . lang("producers_platform_description_long") . "
"; - - my $teams_display = ''; - - if ( ( defined $user_ref->{org} ) and ( $user_ref->{org} ne "" ) ) { - - # Existing user with an accepted organization - - $html .= "" - . sprintf( - lang("this_is_a_pro_account_for_org"), - "" . $user_ref->{org} . "" - ) . "
"; - } - - # Pro platform is only for food right now - - elsif ((defined $options{product_type}) and ($options{product_type} eq "food")) { - # New user or existing user without an accepted organization - - my $pro_checked = ''; - my $pro_org_display = 'style="display:none"'; - - # Check the "pro account" checkbox for register screen on the producers platform - - if (((defined $user_ref->{pro}) and ($user_ref->{pro})) - or ((defined $server_options{producers_platform}) and ($type eq "add"))) { - $pro_checked = "checked"; - $pro_org_display = ""; - $teams_display = 'style="display:none"'; - } - - $html .= "" - . "" - . "" . lang("producer_or_brand") . separator_before_colon($lc) . ": " - . textfield(-id=>'requested_org', -name=>'requested_org', -value=>$user_ref->{requested_org}, -override=>1) - . "
"; - - my $requested_org_ref = retrieve_org($user_ref->{requested_org}); - - if ( defined $requested_org_ref ) { - - $html .= "" . sprintf(lang("add_user_existing_org"), org_name($requested_org_ref)) . "
" - . "" . lang("add_user_existing_org_pending") . "
" - . "" .lang("please_email_producers") . "
" - . "" . lang("enter_name_of_org") . "
"; - } - - $html .= "" - . lang("teams_description") . "
" . lang("teams_names_warning") . "
" - . '