From db7add88fef1cbc2055b65a8e50cce8a36a5cedd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:59:47 +0000 Subject: [PATCH 1/7] chore(deps): bump wicked_pdf from 2.6.3 to 2.8.0 Bumps [wicked_pdf](https://github.com/mileszs/wicked_pdf) from 2.6.3 to 2.8.0. - [Release notes](https://github.com/mileszs/wicked_pdf/releases) - [Changelog](https://github.com/mileszs/wicked_pdf/blob/master/CHANGELOG.md) - [Commits](https://github.com/mileszs/wicked_pdf/commits) --- updated-dependencies: - dependency-name: wicked_pdf dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ea6f3f1c07..03b2006a7a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -837,7 +837,7 @@ GEM websocket-extensions (0.1.5) whenever (1.0.0) chronic (>= 0.6.3) - wicked_pdf (2.6.3) + wicked_pdf (2.8.0) activesupport wkhtmltopdf-binary (0.12.6.7) xml-simple (1.1.8) From fa004d0897da8e31bdd16aeb78be4e252b823935 Mon Sep 17 00:00:00 2001 From: wandji20 Date: Tue, 6 Aug 2024 11:23:50 +0100 Subject: [PATCH 2/7] Remove wicked pdf stylsheet include tag in order report pdf [OFN-12214] --- app/helpers/application_helper.rb | 9 --------- app/views/spree/admin/orders/invoice.html.haml | 2 -- app/views/spree/admin/orders/invoice2.html.haml | 2 -- app/views/spree/admin/orders/invoice4.html.haml | 2 -- 4 files changed, 15 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2f470529b2..f7787e35b9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -61,15 +61,6 @@ module ApplicationHelper classes << shopfront_layout end - def pdf_stylesheet_pack_tag(source) - if running_in_development? - options = { media: "all", host: "#{Webpacker.dev_server.host}:#{Webpacker.dev_server.port}" } - stylesheet_pack_tag(source, **options) - else - wicked_pdf_stylesheet_pack_tag(source) - end - end - def cache_with_locale(key = nil, options = {}, &block) cache(cache_key_with_locale(key, I18n.locale), options) do yield(block) diff --git a/app/views/spree/admin/orders/invoice.html.haml b/app/views/spree/admin/orders/invoice.html.haml index d1dbc32264..9f161fcbbf 100644 --- a/app/views/spree/admin/orders/invoice.html.haml +++ b/app/views/spree/admin/orders/invoice.html.haml @@ -1,5 +1,3 @@ -= pdf_stylesheet_pack_tag "mail" - %table{:width => "100%"} %tbody %tr{ valign: "top" } diff --git a/app/views/spree/admin/orders/invoice2.html.haml b/app/views/spree/admin/orders/invoice2.html.haml index c55a1f6637..5ae2b01a8d 100644 --- a/app/views/spree/admin/orders/invoice2.html.haml +++ b/app/views/spree/admin/orders/invoice2.html.haml @@ -1,5 +1,3 @@ -= pdf_stylesheet_pack_tag "mail" - %table{:width => "100%"} %tbody %tr{ valign: "top" } diff --git a/app/views/spree/admin/orders/invoice4.html.haml b/app/views/spree/admin/orders/invoice4.html.haml index bf7eee3679..38bacf8d48 100644 --- a/app/views/spree/admin/orders/invoice4.html.haml +++ b/app/views/spree/admin/orders/invoice4.html.haml @@ -1,5 +1,3 @@ -= pdf_stylesheet_pack_tag "mail" - %table{:width => "100%"} %tbody %tr{ valign: "top" } From 506126c1d3da902fa4af1db87a8c0f544b806c40 Mon Sep 17 00:00:00 2001 From: wandji20 Date: Mon, 12 Aug 2024 21:46:34 +0100 Subject: [PATCH 3/7] Bump wicked_pdf to version 2.8.1 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 03b2006a7a..f1e84780fe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -837,7 +837,7 @@ GEM websocket-extensions (0.1.5) whenever (1.0.0) chronic (>= 0.6.3) - wicked_pdf (2.8.0) + wicked_pdf (2.8.1) activesupport wkhtmltopdf-binary (0.12.6.7) xml-simple (1.1.8) From 7392079d4db432efc7a6db5744389933ddea7354 Mon Sep 17 00:00:00 2001 From: wandji20 Date: Mon, 12 Aug 2024 21:49:15 +0100 Subject: [PATCH 4/7] Move mail related styles to asset pipeline [OFN-12214] --- app/assets/stylesheets/mail.scss | 1 + app/assets/stylesheets/mail/all.scss | 3 +++ app/{webpacker/css => assets/stylesheets}/mail/email.scss | 0 .../css => assets/stylesheets}/mail/payments_list.scss | 0 app/webpacker/css/mail/all.scss | 3 --- app/webpacker/packs/mail.scss | 1 - config/application.rb | 1 + 7 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 app/assets/stylesheets/mail.scss create mode 100644 app/assets/stylesheets/mail/all.scss rename app/{webpacker/css => assets/stylesheets}/mail/email.scss (100%) rename app/{webpacker/css => assets/stylesheets}/mail/payments_list.scss (100%) delete mode 100644 app/webpacker/css/mail/all.scss delete mode 100644 app/webpacker/packs/mail.scss diff --git a/app/assets/stylesheets/mail.scss b/app/assets/stylesheets/mail.scss new file mode 100644 index 0000000000..e35654c0d2 --- /dev/null +++ b/app/assets/stylesheets/mail.scss @@ -0,0 +1 @@ +@import './mail/all.scss'; diff --git a/app/assets/stylesheets/mail/all.scss b/app/assets/stylesheets/mail/all.scss new file mode 100644 index 0000000000..fa8445d726 --- /dev/null +++ b/app/assets/stylesheets/mail/all.scss @@ -0,0 +1,3 @@ +@import '../../../webpacker/css/admin/globals/palette.scss'; +@import 'email'; +@import 'payments_list'; diff --git a/app/webpacker/css/mail/email.scss b/app/assets/stylesheets/mail/email.scss similarity index 100% rename from app/webpacker/css/mail/email.scss rename to app/assets/stylesheets/mail/email.scss diff --git a/app/webpacker/css/mail/payments_list.scss b/app/assets/stylesheets/mail/payments_list.scss similarity index 100% rename from app/webpacker/css/mail/payments_list.scss rename to app/assets/stylesheets/mail/payments_list.scss diff --git a/app/webpacker/css/mail/all.scss b/app/webpacker/css/mail/all.scss deleted file mode 100644 index 087d2d1310..0000000000 --- a/app/webpacker/css/mail/all.scss +++ /dev/null @@ -1,3 +0,0 @@ -@import '../admin/globals/palette.scss'; -@import 'email'; -@import 'payments_list'; diff --git a/app/webpacker/packs/mail.scss b/app/webpacker/packs/mail.scss deleted file mode 100644 index d4f981e355..0000000000 --- a/app/webpacker/packs/mail.scss +++ /dev/null @@ -1 +0,0 @@ -@import "../css/mail/all.scss"; diff --git a/config/application.rb b/config/application.rb index 09d8fb5abe..420da2392a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -216,6 +216,7 @@ module Openfoodnetwork config.assets.precompile += ['web/all.js'] config.assets.precompile += ['darkswarm/all.js'] config.assets.precompile += ['shared/*'] + config.assets.precompile += %w(mail.scss) config.assets.precompile += ['*.jpg', '*.jpeg', '*.png', '*.gif' '*.svg'] # Highlight code that triggered database queries in logs. From 58872a7017f5776893c5344e1bfca2bca8ef7704 Mon Sep 17 00:00:00 2001 From: wandji20 Date: Tue, 13 Aug 2024 18:23:18 +0100 Subject: [PATCH 5/7] Include mail stylsheet tag in invoice pdf files and mailer layout [OFN-12214] --- app/views/layouts/mailer.html.haml | 2 +- app/views/spree/admin/orders/invoice.html.haml | 2 ++ app/views/spree/admin/orders/invoice2.html.haml | 2 ++ app/views/spree/admin/orders/invoice4.html.haml | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/mailer.html.haml b/app/views/layouts/mailer.html.haml index 0a70687f14..12c654b3d1 100644 --- a/app/views/layouts/mailer.html.haml +++ b/app/views/layouts/mailer.html.haml @@ -5,7 +5,7 @@ %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/ %title = Spree::Config[:site_name] - = stylesheet_pack_tag 'mail' + = stylesheet_link_tag 'mail' %body{:bgcolor => "#FFFFFF" } - unless @hide_ofn_navigation %table.head-wrap{:bgcolor => "#f2f2f2"} diff --git a/app/views/spree/admin/orders/invoice.html.haml b/app/views/spree/admin/orders/invoice.html.haml index 9f161fcbbf..a72e7c1fff 100644 --- a/app/views/spree/admin/orders/invoice.html.haml +++ b/app/views/spree/admin/orders/invoice.html.haml @@ -1,3 +1,5 @@ += wicked_pdf_stylesheet_link_tag "mail" + %table{:width => "100%"} %tbody %tr{ valign: "top" } diff --git a/app/views/spree/admin/orders/invoice2.html.haml b/app/views/spree/admin/orders/invoice2.html.haml index 5ae2b01a8d..935e370d7a 100644 --- a/app/views/spree/admin/orders/invoice2.html.haml +++ b/app/views/spree/admin/orders/invoice2.html.haml @@ -1,3 +1,5 @@ += wicked_pdf_stylesheet_link_tag "mail" + %table{:width => "100%"} %tbody %tr{ valign: "top" } diff --git a/app/views/spree/admin/orders/invoice4.html.haml b/app/views/spree/admin/orders/invoice4.html.haml index 38bacf8d48..f05a463b88 100644 --- a/app/views/spree/admin/orders/invoice4.html.haml +++ b/app/views/spree/admin/orders/invoice4.html.haml @@ -1,3 +1,5 @@ += wicked_pdf_stylesheet_link_tag "mail" + %table{:width => "100%"} %tbody %tr{ valign: "top" } From f325857e1fa979e0642fb670ea30287742abf615 Mon Sep 17 00:00:00 2001 From: wandji20 Date: Tue, 13 Aug 2024 17:10:46 +0100 Subject: [PATCH 6/7] Strip end of long invoice table header names due to names not properly parsed when converting pdf to text [OFN-12214] --- spec/system/admin/invoice_print_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/system/admin/invoice_print_spec.rb b/spec/system/admin/invoice_print_spec.rb index ef1ac6d405..1709f934d0 100644 --- a/spec/system/admin/invoice_print_spec.rb +++ b/spec/system/admin/invoice_print_spec.rb @@ -535,10 +535,10 @@ RSpec.describe ' # header expect(page).to have_content "Item Qty" expect(page).to have_content "Weight / VOL." - expect(page).to have_content "Price Per unit (Excl. tax)" - expect(page).to have_content "Total price (Excl. tax)" + expect(page).to have_content "Price Per unit (Excl." + expect(page).to have_content "Total price (Excl." expect(page).to have_content "Tax rate" - expect(page).to have_content "Total price (Incl. tax)" + expect(page).to have_content "Total price (Incl." # first line item, no tax expect(page).to have_content Spree::Product.first.name.to_s expect(page).to have_content "($12,540.00 / kg)" # unit price @@ -639,10 +639,10 @@ RSpec.describe ' # header expect(page).to have_content "Item Qty" expect(page).to have_content "Weight / VOL." - expect(page).to have_content "Price Per unit (Excl. tax)" - expect(page).to have_content "Total price (Excl. tax)" + expect(page).to have_content "Price Per unit (Excl." + expect(page).to have_content "Total price (Excl." expect(page).to have_content "Tax rate" - expect(page).to have_content "Total price (Incl. tax)" + expect(page).to have_content "Total price (Incl." # first line item, no tax expect(page).to have_content Spree::Product.first.name.to_s expect(page).to have_content "($12,540.00 / kg)" # unit price From 4a30493716e86829fa3b6e9d50f33ddd29f2b495 Mon Sep 17 00:00:00 2001 From: wandji20 Date: Tue, 13 Aug 2024 18:29:27 +0100 Subject: [PATCH 7/7] Improve code style [OFN-12214] --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 420da2392a..a1bda0a7d5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -216,7 +216,7 @@ module Openfoodnetwork config.assets.precompile += ['web/all.js'] config.assets.precompile += ['darkswarm/all.js'] config.assets.precompile += ['shared/*'] - config.assets.precompile += %w(mail.scss) + config.assets.precompile += ['mail.scss'] config.assets.precompile += ['*.jpg', '*.jpeg', '*.png', '*.gif' '*.svg'] # Highlight code that triggered database queries in logs.