Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sonar.sources=cgi,docker,lib,scripts,templates,scss,html/css,html/js,docker-compose.yml,Dockerfile,Dockerfile.frontend,gulpfile.ts,Makefile
sonar.tests=tests

sonar.exclusions=scripts/obsolete/**/*,html/css/normalize.css,tests/integration/expected_test_results/**/*,scripts/taxonomies/generators/**/*
sonar.exclusions=scripts/obsolete/**/*,html/css/normalize.css,scripts/taxonomies/generators/**/*
sonar.test.exclusions=tests/unit/expected_test_results/**/*,tests/integration/expected_test_results/**/*
4 changes: 1 addition & 3 deletions .test_groups_cache/integration_groups.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Auto-calculated 9 groups for 48 tests (total estimated time: 24.0m)
# Auto-calculated 9 groups for 48 tests (total estimated time: 24m)
# Generated test groups for integration tests
# Generated at: Thu Oct 30 18:25:31 2025

INTEGRATION_GROUP_1_TESTS := add_update_to_redis.t api_v3_product_revert.t change_product_code_and_product_type.t export.t oidc_signout.t unknown_tags.t
INTEGRATION_GROUP_2_TESTS := api_attribute_groups.t api_v3_product_services.t convert_and_import_excel_file.t external_sources.t page_crawler.t upload_images.t
INTEGRATION_GROUP_3_TESTS := api_cgi_nutrients.t api_v3_product_services_external.t cors.t facets.t product_read.t web_html.t
Expand Down
4 changes: 1 addition & 3 deletions .test_groups_cache/unit_groups.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Auto-calculated 6 groups for 77 tests (total estimated time: 38.5m)
# Auto-calculated 6 groups for 77 tests (total estimated time: 38m)
# Generated test groups for unit tests
# Generated at: Thu Oct 30 18:25:31 2025

UNIT_GROUP_1_TESTS := additives.t attributes.t data_quality_tags_panel.t environmental_impact.t i18n.t ingredients_analysis.t ingredients_parsing_todo.t lang.t nutrition.t packaging_stats.t products.t store.t templates.t
UNIT_GROUP_2_TESTS := additives_tags.t booleans.t dataquality.t environmental_score.t images.t ingredients_clean.t ingredients_percent.t load_csv_or_excel_file.t nutrition_ciqual.t parse_origins_from_text.t recipes.t tags.t test.t
UNIT_GROUP_3_TESTS := all_pod_correct.t brevo.t dataqualitydimensions.t food.t import.t ingredients_contents.t ingredients_preparsing.t match_ingredient_origin.t nutrition_estimation.t paths.t redis.t tags_unit.t text.t
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const jsLibSrc = [
"./node_modules/jquery-cropper/dist/jquery-cropper.js",
"./node_modules/jquery-form/src/jquery.form.js",
"./node_modules/highcharts/highcharts.js",
"./node_modules/jsvectormap/dist/jsvectormap.js",
"./node_modules/jsvectormap/dist/jsvectormap.esm.js",
"./node_modules/jsvectormap/dist/maps/world-merc.js",
"./node_modules/select2/dist/js/select2.min.js",
"./node_modules/jsbarcode/dist/JsBarcode.all.min.js",
Expand Down
17 changes: 10 additions & 7 deletions html/js/display-list-of-tags.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is part of Product Opener.
//
// Product Opener
// Copyright (C) 2011-2024 Association Open Food Facts
// Copyright (C) 2011-2025 Association Open Food Facts
// Contact: [email protected]
// Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France
//
Expand All @@ -18,14 +18,17 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

/*exported displayWorldMap*/
/*global lang jsVectorMap*/
/*global lang*/

import jsVectorMap from 'jsvectormap';
// eslint-disable-next-line sort-imports
import './world-merc.js';

function getServerDomain() {
return (/^https?:\/\/([^/?#]+)(?:[/?#]|$)/i).exec(window.location.href)[1];
return (/^https?:\/\/([^/?#]+)(?:[/?#]|$)/i).exec(globalThis.location.href)[1];
}

function displayWorldMap(selector, countries) {
export function displayWorldMap(selector, countries) {
const countries_map_data = countries.data;
const countries_map_links = countries.links;
const countries_map_names = countries.names;
Expand All @@ -52,12 +55,12 @@ function displayWorldMap(selector, countries) {
},
onRegionClick: (_e, code) => {
if (countries_map_links[code]) {
window.location.href = `//${getServerDomain()}${countries_map_links[code]}`;
globalThis.location.href = `//${getServerDomain()}${countries_map_links[code]}`;
}
},
});

window.addEventListener("resize", () => {
globalThis.addEventListener("resize", () => {
map.updateSize();
});
}
31 changes: 12 additions & 19 deletions lib/ProductOpener/Display.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is part of Product Opener.
#
# Product Opener
# Copyright (C) 2011-2024 Association Open Food Facts
# Copyright (C) 2011-2025 Association Open Food Facts
# Contact: [email protected]
# Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France
#
Expand Down Expand Up @@ -2451,26 +2451,19 @@ HTML

# countries map?
if (keys %{$countries_map_data} > 0) {
$request_ref->{initjs}
.= 'var countries_map_data=JSON.parse(' . $json->encode($json->encode($countries_map_data)) . ');'
.= 'var countries_map_links=JSON.parse(' . $json->encode($json->encode($countries_map_links)) . ');'
.= 'var countries_map_names=JSON.parse(' . $json->encode($json->encode($countries_map_names)) . ');'
.= <<"JS";
displayWorldMap('#world-map', { 'data': countries_map_data, 'links': countries_map_links, 'names': countries_map_names });
JS
$request_ref->{scripts} .= <<SCRIPTS
<script src="$static_subdomain/js/dist/jsvectormap.js"></script>
<script src="$static_subdomain/js/dist/world-merc.js"></script>
<script src="$static_subdomain/js/dist/display-list-of-tags.js"></script>
SCRIPTS
;
my $map_html = <<HTML
<div id="world-map" style="min-width: 250px; max-width: 600px; min-height: 250px; max-height: 400px;"></div>
my $mapData = {
data => $countries_map_data,
links => $countries_map_links,
names => $countries_map_names,
};

HTML
;
$html = $map_html . $html;
my $map_template_data_ref = {mapData => $mapData,};

my $map_html = '';
process_template('web/pages/countries_map/map_of_countries.tt.html',
$map_template_data_ref, \$map_html, $request_ref)
|| ($map_html .= 'template error: ' . $tt->error());
$html = $map_html . $html;
}

#if ($tagtype eq 'categories') {
Expand Down
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"jquery-cropper": "^1.0.2",
"jquery-form": "^4.3.0",
"jquery-ui": "1.14.1",
"jsvectormap": "^1.6.0",
"jsvectormap": "^1.7.0",
"leaflet": "^1.7.1",
"leaflet.markercluster": "1.5.3",
"osmtogeojson": "^3.0.0-beta.4",
Expand Down
7 changes: 7 additions & 0 deletions templates/web/common/site_layout.tt.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
<link rel="stylesheet" href="[% static_subdomain %]/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="[% static_subdomain %]/css/dist/select2.min.css">
<link rel="search" href="[% formatted_subdomain %]/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="[% options.site_name %]">
<script type="importmap">
{
"imports": {
"jsvectormap": "[% static_subdomain %]/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="[% static_subdomain %]/js/dist/off-webcomponents.bundled.js"></script>
[% header %]
<style media="all">
Expand Down
10 changes: 10 additions & 0 deletions templates/web/pages/countries_map/map_of_countries.tt.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- start templates/[% template.name %] -->

<div id="world-map" style="min-width: 250px; max-width: 600px; min-height: 250px; max-height: 400px;"></div>

<script type="module">
import { displayWorldMap } from '[% static_subdomain %]/js/dist/display-list-of-tags.js';
displayWorldMap('#world-map', [% encode_json(mapData) %]);
</script>

<!-- end templates/[% template.name %] -->
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>

<style media="all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//be-fr.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>

<style media="all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//be-fr.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>

<style media="all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>

<style media="all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>
<meta name="x:card" content="product">
<meta name="x:site" content="@OpenFoodFacts">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>

<style media="all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>

<style media="all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>

<style media="all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>
<link rel="stylesheet" href="//static.openfoodfacts.localhost/js/datatables.min.css">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>

<style media="all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>
<meta name="x:card" content="product">
<meta name="x:site" content="@OpenFoodFacts">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>

<style media="all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//ch-es.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>

<style media="all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>
<meta name="x:card" content="product">
<meta name="x:site" content="@OpenFoodFacts">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/jqueryui/themes/base/jquery-ui.css" data-base-layout="true">
<link rel="stylesheet" href="//static.openfoodfacts.localhost/css/dist/select2.min.css">
<link rel="search" href="//world.openfoodfacts.localhost/cgi/opensearch.pl" type="application/opensearchdescription+xml" title="Open Food Facts">
<script type="importmap">
{
"imports": {
"jsvectormap": "//static.openfoodfacts.localhost/js/dist/jsvectormap.esm.js"
}
}
</script>
<script type="module" src="//static.openfoodfacts.localhost/js/dist/off-webcomponents.bundled.js"></script>

<style media="all">
Expand Down
Loading
Loading