From ef878b343cdc1da44869c90827b5d2b220928691 Mon Sep 17 00:00:00 2001 From: wandji20 Date: Mon, 12 Aug 2024 21:50:56 +0100 Subject: [PATCH] Include mail stylsheet tag in invoice pdf files and layout [OFN-12214] --- app/views/layouts/pdf.html.haml | 50 +------------------ .../spree/admin/orders/invoice.html.haml | 2 + .../spree/admin/orders/invoice2.html.haml | 2 + .../spree/admin/orders/invoice4.html.haml | 2 + 4 files changed, 7 insertions(+), 49 deletions(-) diff --git a/app/views/layouts/pdf.html.haml b/app/views/layouts/pdf.html.haml index 81b43b658896..536d7c58ab92 100644 --- a/app/views/layouts/pdf.html.haml +++ b/app/views/layouts/pdf.html.haml @@ -2,55 +2,7 @@ %html %head %meta{charset: 'utf-8'} - -# Using wicked_pdf_stylesheet_pack_tag with a new pdf pack was not working when using - -# WickedPdf.new.pdf_from_string cause the css file reference was not absolute - -# So I ended up putting inline css here, so it's included for sure in the PDF - :css - body { - width: 100%; - height: 100%; - margin: 0; - padding: 0; - font-family: system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif; - color: #212529; - } - table { - width: 100%; - border-collapse: collapse; - } - th { - text-align: left; - } - th, td { - padding: 7px 5px; - vertical-align: middle; - text-overflow: ellipsis; - padding-top: 12px; - } - tr { - border-bottom: 1px solid #e2e2e2; - } - thead { - background-color: #f6f6f6; - border-bottom: 1px solid grey; - } - .h1, .h2, .h3 { - font-weight: bold; - padding-top: 15px; - } - .h1 { - font-size: 1.6rem; - padding-top: 20px; - } - .h2 { - font-size: 1.3rem; - } - .h3 { - font-size: 1.15rem; - } - .text-bold { - font-weight: bold; - } + wicked_pdf_stylesheet_link_tag 'mail' %body = yield diff --git a/app/views/spree/admin/orders/invoice.html.haml b/app/views/spree/admin/orders/invoice.html.haml index 9f161fcbbf28..a72e7c1fffa4 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 5ae2b01a8d89..935e370d7a31 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 38bacf8d48f0..f05a463b8884 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" }