Emphasise ways to get help in user emails

We had a very prominent footer showing how to get in contact with the
local instance people but most users need to get in contact with the
enterprise they are buying from. So removing all those details and
replacing them by a simple "powered by" line will hopefully direct
attention to the shop's contact details.
This commit is contained in:
Maikel Linke
2021-01-15 11:57:47 +11:00
parent 3e0547f563
commit a971b62068
12 changed files with 45 additions and 5 deletions

View File

@@ -63,6 +63,12 @@ p.notice {
margin-top: 20px;
}
.powered-by-ofn {
background-color: #ebebeb;
padding: .5em;
text-align: center;
}
table.social {
background-color: #ebebeb;

View File

@@ -0,0 +1,13 @@
# 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
end

View File

@@ -6,6 +6,7 @@ module Spree
helper SpreeCurrencyHelper
helper Spree::Admin::PaymentsHelper
helper OrderHelper
helper MailerHelper
include I18nHelper
def cancel_email(order_or_order_id, resend = false)

View File

@@ -1,5 +1,6 @@
class SubscriptionMailer < Spree::BaseMailer
helper CheckoutHelper
helper MailerHelper
helper ShopMailHelper
helper OrderHelper
helper Spree::Admin::PaymentsHelper

View File

@@ -0,0 +1,2 @@
%p.powered-by-ofn
= t(".powered_html", open_food_network: footer_ofn_link)

View File

@@ -26,4 +26,4 @@
= t(".unpaid_order")
= render 'signoff'
= render 'shared/mailers/social_and_contact'
= render 'shared/mailers/powered_by'

View File

@@ -25,4 +25,4 @@
= render 'shipping'
= render 'special_instructions'
= render 'signoff'
= render 'shared/mailers/social_and_contact'
= render 'shared/mailers/powered_by'

View File

@@ -12,7 +12,7 @@
= render 'shared/mailers/signoff'
= render 'shared/mailers/social_and_contact'
= render 'shared/mailers/powered_by'
%p.notice
= t :email_confirmation_notice_unexpected, sitename: @instance, contact: @contact

View File

@@ -19,4 +19,4 @@
%p &nbsp;
= render 'shared/mailers/signoff'
= render 'shared/mailers/social_and_contact'
= render 'shared/mailers/powered_by'

View File

@@ -19,4 +19,4 @@
%p &nbsp;
= render 'shared/mailers/signoff'
= render 'shared/mailers/social_and_contact'
= render 'shared/mailers/powered_by'

View File

@@ -1252,6 +1252,10 @@ en:
hide_closed_shops: "Hide closed shops"
show_on_map: "Show all on the map"
shared:
mailers:
powered_by:
open_food_network: "Open Food Network"
powered_html: "Your shopping experience is powered by the %{open_food_network}."
menu:
cart:
cart: "Cart"

View File

@@ -132,6 +132,19 @@ describe Spree::OrderMailer do
Spree::OrderMailer.confirm_email_for_customer(order.id).deliver_now
expect(ActionMailer::Base.deliveries.first.reply_to).to eq([distributor.contact.email])
end
it "includes a link to the configured instance email address" do
mail = Spree::OrderMailer.confirm_email_for_customer(order.id)
expect(mail.body.encoded).to include "mailto:hello@openfoodnetwork.org"
end
it "includes a link to the OFN global website if no email address is available" do
expect(ContentConfig).to receive(:footer_email).and_return("")
mail = Spree::OrderMailer.confirm_email_for_customer(order.id)
expect(mail.body.encoded).to include "https://www.openfoodnetwork.org"
end
end
describe "for shops" do