From b2f90ea04de040a9dd9eb5056c3633c28c9ed089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Mon, 22 Jul 2024 16:31:44 +0200 Subject: [PATCH 01/10] fix: change_main_contact.pl (#10548) --- scripts/migrations/2024_07_change_main_contact.pl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/migrations/2024_07_change_main_contact.pl b/scripts/migrations/2024_07_change_main_contact.pl index 110e024335c86..a71cffd944102 100755 --- a/scripts/migrations/2024_07_change_main_contact.pl +++ b/scripts/migrations/2024_07_change_main_contact.pl @@ -52,25 +52,32 @@ or ($org_ref->{main_contact} =~ /[\p{Z}\p{C}]/) # contains unicode whitespace or control characters or (grep {$org_ref->{main_contact} eq $_} @not_users) ) # shouldn't be a main contact + or (not defined $org_ref->{main_contact}) ) { + if (defined $org_ref->{main_contact}) { + print "previous main contact: " . $org_ref->{main_contact} . "\n"; + } $org_ref->{main_contact} = undef; # take the first admin as main contact if available - if (defined $org_ref->{admins} and @{$org_ref->{admins}}) { + print $org_id . "\n"; + if (defined $org_ref->{admins}) { # find the first admin that is not in the list of users that are not users # and set it as main contact my $admin = undef; - foreach my $admin_id (@{$org_ref->{admins}}) { + foreach my $admin_id (sort keys %{$org_ref->{admins}}) { if (not grep {$admin_id eq $_} @not_users) { $admin = $admin_id; + $org_ref->{main_contact} = $admin; last; } } - - print "main_contact of $org_id set to $org_ref->{main_contact}\n"; + if (defined $org_ref->{main_contact}) { + print "main_contact of $org_id set to $org_ref->{main_contact}\n"; + } } else { print "main_contact of $org_id set to undef\n"; From ecb4f1294bb8324e984d9c391013d6e167a4d7b8 Mon Sep 17 00:00:00 2001 From: Alex Garel Date: Mon, 22 Jul 2024 16:35:01 +0200 Subject: [PATCH 02/10] =?UTF-8?q?build:=C2=A0fix=20working=20tree=20removi?= =?UTF-8?q?ng=20shared-services=20(#10580)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the deps subdir was wrongly added to the repository. --- .gitignore | 1 + deps/openfoodfacts-shared-services | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 160000 deps/openfoodfacts-shared-services diff --git a/.gitignore b/.gitignore index a5923831f10ed..e9d5f0fdf1270 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,4 @@ taxonomies/*.all.txt # Shared services and other dependencies /deps +/deps/* diff --git a/deps/openfoodfacts-shared-services b/deps/openfoodfacts-shared-services deleted file mode 160000 index a79f5d5d0a705..0000000000000 --- a/deps/openfoodfacts-shared-services +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a79f5d5d0a70580ad408e7cc929bbe85be6fe172 From ce60b8f188cb2bfda31dec2a050416399f6d2829 Mon Sep 17 00:00:00 2001 From: Antoine B <56827368+4nt0ineB@users.noreply.github.com> Date: Tue, 23 Jul 2024 09:07:19 +0200 Subject: [PATCH 03/10] feat: added a drag and drop zone in pro platform (#10569) ### What Added a drag and drop zone to the pro platform to upload product data. ### Screenshot ![Peek 2024-07-19 13-11](https://github.com/user-attachments/assets/72ddea1b-e46a-4e80-b434-dcd3dc0ea3a6) --------- Co-authored-by: Alex Garel --- icons/upload_file.svg | 1 + po/common/common.pot | 8 +++ po/common/en.po | 10 +++- po/common/fr.po | 10 +++- scss/_off.scss | 44 +++++++++++++++- .../import_file_upload.tt.html | 52 ++++++++++++------- .../import_file_upload.tt.js | 42 +++++++++++++++ 7 files changed, 145 insertions(+), 22 deletions(-) create mode 100644 icons/upload_file.svg diff --git a/icons/upload_file.svg b/icons/upload_file.svg new file mode 100644 index 0000000000000..4353688352705 --- /dev/null +++ b/icons/upload_file.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/po/common/common.pot b/po/common/common.pot index cc6f046778566..f34fe313f6984 100644 --- a/po/common/common.pot +++ b/po/common/common.pot @@ -7060,6 +7060,14 @@ msgctxt "last_import" msgid "Last import date" msgstr "Last import date" +msgctxt "drop_a_file" +msgid "Drop" +msgstr "Drop" + +msgctxt "select_product_data_file" +msgid "Select a file with product data" +msgstr "Select a file with product data" + msgctxt "number_of_products_without_nutriscore" msgid "Number of products without Nutri-Score" msgstr "Number of products without Nutri-Score" diff --git a/po/common/en.po b/po/common/en.po index d3dc3083329a3..9f834d3bcc34d 100644 --- a/po/common/en.po +++ b/po/common/en.po @@ -7046,6 +7046,14 @@ msgctxt "last_import" msgid "Last import date" msgstr "Last import date" +msgctxt "drop_a_file" +msgid "Drop" +msgstr "Drop" + +msgctxt "select_product_data_file" +msgid "Select a file with product data" +msgstr "Select a file with product data" + msgctxt "number_of_products_without_nutriscore" msgid "Number of products without Nutri-Score" msgstr "Number of products without Nutri-Score" @@ -7068,4 +7076,4 @@ msgstr "Opp. for Nutri-Score improvements" msgctxt "date_of_last_update" msgid "Date of last update" -msgstr "Date of last update" \ No newline at end of file +msgstr "Date of last update" diff --git a/po/common/fr.po b/po/common/fr.po index d9644cc6d3f28..6543b5efed0d3 100644 --- a/po/common/fr.po +++ b/po/common/fr.po @@ -6942,4 +6942,12 @@ msgstr "Date de dernière connexion" msgctxt "last_import" msgid "Dernière date d'importation" -msgstr "Dernière date d'importation" \ No newline at end of file +msgstr "Dernière date d'importation" + +msgctxt "drop_a_file" +msgid "Drop" +msgstr "Glissez" + +msgctxt "select_product_data_file" +msgid "Select a file with product data" +msgstr "Choisissez un fichier avec les données des produits" \ No newline at end of file diff --git a/scss/_off.scss b/scss/_off.scss index c60fb9be19531..b22bae4d167d0 100644 --- a/scss/_off.scss +++ b/scss/_off.scss @@ -1903,4 +1903,46 @@ div.open-in-crm { flex-grow: 1; margin: 0 1em 0 0; } -} \ No newline at end of file +} +/* Styling drag and drop panel on /cgi/import_file_upload.pl */ +.dragover { + border: 2px dashed #ff8614 !important; + background-color: #ffefef; + + & #upload_icon { + color: #ffa753!important; + } + + & [id^="file_input_button_"] { + background-color: color.scale($button-bg-color, $lightness: $button-function-factor * -0.5); + color: #fff; + } +} + +.drop-zone { + border: 2px dashed black; + border-radius: 5px; + background-color: #ece9e6; + padding: 2em; + + & > #upload_icon { + display: flex; + justify-content: center; + align-items: center; + color: #c6c0b2; + + svg { + height: 2.8em; + width: auto; + margin-bottom: 0.5em; + } + } + + & > #description { + text-align: center; + font-size: 1.2em; + color: #8c877c; + margin-bottom: 1em; + } +} + diff --git a/templates/web/pages/import_file_upload/import_file_upload.tt.html b/templates/web/pages/import_file_upload/import_file_upload.tt.html index 5458f5d678102..fc081518168fe 100644 --- a/templates/web/pages/import_file_upload/import_file_upload.tt.html +++ b/templates/web/pages/import_file_upload/import_file_upload.tt.html @@ -15,28 +15,42 @@

[% lang("download_sample_import_file") %]

-
- -
- [% display_icon('arrow_upward') %] [% lang("upload_product_data_file") %] - -
-
- -