Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Email improvements #12811

Draft
wants to merge 36 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
129ce66
Header: Improve logo, resizing and styles
drummer83 Dec 25, 2023
ac70908
Improve email footer of all emails
drummer83 Dec 25, 2023
4ee7889
Create styled email for reset password instructions
drummer83 Dec 26, 2023
4d998be
Delete text versions of emails
drummer83 Dec 26, 2023
30ed5af
Quick beautification of test email
drummer83 Dec 26, 2023
d8072aa
White labelling ALL customer facing emails
drummer83 Dec 31, 2023
2baf6c1
Add new partial for greeting, intro text and logo (if present) to use…
drummer83 Jan 17, 2024
df63cc0
Add new partial to user_mailers and re-organize used translation keys
drummer83 Jan 18, 2024
09eef04
Add new partial to test_mailer and re-organize used translation keys
drummer83 Jan 18, 2024
ffa0f27
Add new partial to shipment_mailer and re-organize used translation keys
drummer83 Jan 18, 2024
ab05431
Add new partial to order_mailers and re-organize used translation keys
drummer83 Jan 18, 2024
2283b63
Add new partial to enterprise_mailers and re-organize used translatio…
drummer83 Jan 19, 2024
20ac1f2
Add new partial to payment_mailers and re-organize used translation keys
drummer83 Jan 19, 2024
e5c0efd
Add new partial to producer_mailer and re-organize used translation keys
drummer83 Jan 19, 2024
68ceee2
Add new partial to report_mailer and re-organize used translation keys
drummer83 Jan 19, 2024
fc8331e
Add new partial to subscription_mailers and re-organize used translat…
drummer83 Jan 21, 2024
64fed25
Create, re-arrange and use some shared translation keys
drummer83 Jan 21, 2024
a84a16d
Add signoff to all remaining emails which didn't have one yet
drummer83 Jan 21, 2024
57d2251
Add forgotten text about setting a password after receiving the invit…
drummer83 Jan 21, 2024
03ccd86
Re-arrange the email parts of the en.yml file to make the content str…
drummer83 Jan 21, 2024
678e556
Fix some missing quotation marks in the email parts of the en.yml fil…
drummer83 Jan 21, 2024
778b3c3
Unify and improve email subjects for all emails
drummer83 Jan 30, 2024
e70142f
Add a 'reply to' email address where it makes sense and has been miss…
drummer83 Jan 30, 2024
581627c
Add translations to shipment mailer to send the mail in the customer'…
drummer83 Jan 30, 2024
d91b48a
Fix incorrect laguage of order confirmation email for shop
drummer83 Jan 30, 2024
b786d38
Simplify producer mailer
drummer83 Jan 30, 2024
d5b0f13
Improve user mails
drummer83 Feb 1, 2024
bf7663b
Improve order mails
drummer83 Feb 4, 2024
4727e94
Improve shipping mails
drummer83 Feb 17, 2024
f46e284
Improve payment mails
drummer83 Feb 18, 2024
2b1e862
Improve subscription mails
drummer83 Feb 18, 2024
184105e
Improve enterprise mails
drummer83 Feb 18, 2024
3b3968b
Improve report mail
drummer83 Feb 18, 2024
4fffe4b
Improve producer mail
drummer83 Feb 18, 2024
966ddaa
Improve greeting and intro styling to use less different font sizes a…
drummer83 May 28, 2024
4246662
Reorganise en.yml after rebase
drummer83 Jul 20, 2024
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
1 change: 1 addition & 0 deletions app/assets/stylesheets/mail/all.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import '../../../webpacker/css/admin/globals/palette.scss';
@import 'email';
@import 'payments_list';
@import '../../../webpacker/css/darkswarm/style.scss';
104 changes: 80 additions & 24 deletions app/assets/stylesheets/mail/email.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,52 @@ p.callout {
color: #0096ad;
}

.detail {
& .callout {
margin-top: 40px;
padding: 10px;
}

& p.callout + p {
padding-left: 5px;
}

& .subsection {
margin-left: 10px;
}

& .subsection:last-child {
margin-bottom: 15px;
}
}

p.footer, p.footer_icons a {
color: #999;
}

p.signoff_icons, p.footer_icons {
font-size: 0px;

a {
text-decoration: none;
margin-right: 5px;
}
}

p.signoff_icons a:not(.ofn-i_image) {
font-size: 24px;
}

p.footer_icons a:not(.ofn-i_image) {
font-size: 20px;
}

p.notice {
font-style: italic;
font-size: 12px;
margin-top: 20px;
}

.powered-by-ofn {
background-color: #ebebeb;
padding: .5em;
text-align: center;
}

table.social {
background-color: #ebebeb;

Expand All @@ -83,20 +117,21 @@ table.social {
table.order-summary {
border-collapse: separate;
border-spacing: 0px 10px;
font-size: 14px;

tbody tr td {
padding-left: 5px;
padding-right: 5px;
padding-left: 10px;
padding-right: 10px;
}

thead tr th {
background-color: #f2f2f2;
border-bottom: 1px solid black;
padding-left: 5px;
padding-right: 5px;
padding-left: 10px;
padding-right: 10px;

h4 {
margin-top: 15px;
margin-top: 10px;
}
}

Expand All @@ -107,8 +142,8 @@ table.order-summary {
}

tr td {
padding-left: 5px;
padding-right: 5px;
padding-left: 10px;
padding-right: 10px;
}
}
}
Expand All @@ -121,6 +156,10 @@ table.order-summary {
text-align: right;
}

.middle {
vertical-align: middle;
}

.social .soc-btn {
padding: 3px 7px;
font-size: 12px;
Expand Down Expand Up @@ -166,18 +205,23 @@ a {
img.float-right {
float: right;
display: block;
max-width: 100px;
max-height: 100px;
margin-bottom: 15px;
margin-left: 15px;
}

del.quantity_was {
color: #757575;
}

/* -------------------------------------
* HEADER
* HEADER & FOOTER
*------------------------------------- */

table.head-wrap {
.wrap {
width: 100%;
background-color: #f2f2f2;
}

.header.container table td {
Expand Down Expand Up @@ -224,7 +268,6 @@ table {
h1, h2, h3, h4, h5, h6 {
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
line-height: 1.1;
margin-bottom: 15px;
color: #000;
}

Expand All @@ -246,18 +289,21 @@ h2 {
}

h3 {
font-weight: 500;
font-size: 27px;
font-weight: bold;
font-size: 16px;
margin-bottom: 15px;
}

h4 {
font-weight: 500;
font-size: 23px;
font-weight: bold;
font-size: 14px;
margin-bottom: 5px;
}

h5 {
font-weight: 900;
font-size: 17px;
font-weight: bold;
font-size: 14px;
margin-bottom: 5px;
}

h6 {
Expand All @@ -271,7 +317,7 @@ h6 {
margin: 0 !important;
}

p, ul {
p, ul, span.signoff {
margin-bottom: 10px;
font-weight: normal;
font-size: 14px;
Expand All @@ -280,12 +326,17 @@ p, ul {

p {
&.lead {
font-size: 17px;
font-size: 16px;
}

&.last {
margin-bottom: 0px;
}

&.small {
font-size: 12px;
margin: 5px;
}
}

ul {
Expand Down Expand Up @@ -363,6 +414,10 @@ ul {
}
}

.greeting_and_intro {
overflow: hidden;
}

/* Let's make sure tables in the content area are 100% wide */

/* Odds and ends */
Expand Down Expand Up @@ -429,6 +484,7 @@ ul {

img.float-right {
float: none !important;
margin: 0px auto 15px;
}
}

Expand Down
11 changes: 10 additions & 1 deletion app/assets/stylesheets/mail/payments_list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,18 @@
text-align: left;
}

th, td {
&:first-child {
padding-left: 10px;
}

&:last-child {
padding-right: 10px;
}
}

.amount {
text-align: right;
padding-right: 15px;
}

.payment-state {
Expand Down
10 changes: 0 additions & 10 deletions app/helpers/mailer_helper.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
# frozen_string_literal: true

module MailerHelper
def footer_ofn_link
ofn = I18n.t("shared.mailers.powered_by.open_food_network")

if ContentConfig.footer_email.present?
mail_to ContentConfig.footer_email, ofn
else
link_to ofn, "https://www.openfoodnetwork.org"
end
end

def order_reply_email(order)
order.distributor.email_address.presence || order.distributor.contact.email
end
Expand Down
8 changes: 5 additions & 3 deletions app/mailers/enterprise_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class EnterpriseMailer < ApplicationMailer
def welcome(enterprise)
@enterprise = enterprise
I18n.with_locale valid_locale(@enterprise.owner) do
subject = t('enterprise_mailer.welcome.subject',
subject = t('.subject',
enterprise: @enterprise.name,
sitename: Spree::Config[:site_name])
mail(to: enterprise.contact.email,
Expand All @@ -21,9 +21,11 @@ def manager_invitation(enterprise, user)
@instance = Spree::Config[:site_name]

I18n.with_locale valid_locale(@enterprise.owner) do
subject = t('enterprise_mailer.invite_manager.subject', enterprise: @enterprise.name)
subject = t('.subject',
enterprise: @enterprise.name)
mail(to: user.email,
subject:)
subject:,
reply_to: @enterprise.contact.email)
end
end

Expand Down
19 changes: 14 additions & 5 deletions app/mailers/payment_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,31 @@

class PaymentMailer < ApplicationMailer
include I18nHelper
helper MailerHelper
helper 'checkout'

def authorize_payment(payment)
@payment = payment
subject = I18n.t('spree.payment_mailer.authorize_payment.subject',
distributor: @payment.order.distributor.name)
@order = @payment.order
@hide_ofn_navigation = @payment.order.distributor.hide_ofn_navigation
I18n.with_locale valid_locale(@payment.order.user) do
mail(to: payment.order.email, subject:)
subject = t('.subject',
number: @order.number,
distributor: @order.distributor.name)
mail(to: @order.email,
subject:,
reply_to: @order.distributor.contact.email)
end
end

def authorization_required(payment)
@payment = payment
@order = @payment.order
shop_owner = @payment.order.distributor.owner
subject = I18n.t('spree.payment_mailer.authorization_required.subject',
order: @payment.order)
I18n.with_locale valid_locale(shop_owner) do
subject = t('.subject',
number: @order.number,
distributor: @order.distributor.name)
mail(to: shop_owner.email,
subject:)
end
Expand Down
12 changes: 5 additions & 7 deletions app/mailers/producer_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

load_data

I18n.with_locale(owner_locale) do
I18n.with_locale valid_locale(@producer.owner) do
return unless orders?(order_cycle, producer)

mail(
Expand All @@ -23,10 +23,6 @@

private

def owner_locale
valid_locale(@producer.owner)
end

def load_data
@coordinator = @order_cycle.coordinator

Expand All @@ -41,8 +37,10 @@
end

def subject
order_cycle_subject = I18n.t('producer_mailer.order_cycle.subject', producer: @producer.name)
"[#{Spree::Config.site_name}] #{order_cycle_subject}"
order_cycle_subject = I18n.t('producer_mailer.order_cycle_report.subject',
coordinator: @coordinator.name,

Check warning on line 41 in app/mailers/producer_mailer.rb

View workflow job for this annotation

GitHub Actions / runner / rubocop

[rubocop] reported by reviewdog 🐶 Align the arguments of a method call if they span more than one line. Raw Output: app/mailers/producer_mailer.rb:41:35: C: Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.
producer: @producer.name)
"#{order_cycle_subject}"

Check warning on line 43 in app/mailers/producer_mailer.rb

View workflow job for this annotation

GitHub Actions / runner / rubocop

[rubocop] reported by reviewdog 🐶 Prefer `to_s` over string interpolation. Raw Output: app/mailers/producer_mailer.rb:43:5: C: Style/RedundantInterpolation: Prefer `to_s` over string interpolation.
end

def orders?(order_cycle, producer)
Expand Down
Loading
Loading