Add new partial to shipment_mailer and re-organize used translation keys

Remaining translation keys for emails will be re-organized in a separate commit
This commit is contained in:
drummer83
2024-01-18 02:16:23 +01:00
parent 09eef0487f
commit ffa0f278ac
3 changed files with 18 additions and 14 deletions

View File

@@ -1,12 +1,17 @@
%h3
= t('.dear_customer')
- if @shipment.order.distributor.logo.variable?
- @enterprise_for_logo = @shipment.order.distributor
- greeting_key = "mailers_shared.customer_greeting"
- if @delivery
%p.lead
= t('.instructions', distributor: @shipment.order.distributor.name)
- intro_key = ".shipped_intro_html"
- else
%p.lead
= t('.picked_up_instructions', distributor: @shipment.order.distributor.name)
- intro_key = ".picked_up_intro_html"
= render partial: 'shared/mailers/greeting_and_intro',
locals: { greeting: t(greeting_key, name: @shipment.order.bill_address.firstname),
intro: t(intro_key, distributor: @shipment.order.distributor.name),
enterprise_for_logo: @enterprise_for_logo }
%p
%strong

View File

@@ -368,6 +368,7 @@ en:
# E-Mails
#
mailers_shared:
customer_greeting: "Dear %{name},"
general_greeting: "Hello!"
enterprise_mailer:
confirmation_instructions:
@@ -397,8 +398,6 @@ en:
link_label: "%{name}"
shipment_mailer:
shipped_email:
dear_customer: "Dear Customer,"
instructions: "Your order has been shipped"
shipment_summary: "Shipment Summary"
subject: "Shipment Notification"
thanks: "Thank you for your business."
@@ -3926,6 +3925,10 @@ See the %{link} to find out more about %{sitename}'s features and to start using
error: Webhook endpoint failed to delete
spree:
shipment_mailer:
shipped_email:
shipped_intro_html: "Your order from <strong>%{distributor}</strong> has been shipped."
picked_up_intro_html: "Your order from <strong>%{distributor}</strong> has been picked-up."
test_mailer:
test_email:
greeting: "Congratulations!"
@@ -4721,14 +4724,11 @@ See the %{link} to find out more about %{sitename}'s features and to start using
message: "A payment for order %{order_number} requires additional authorization from the customer. The customer has been notified via email and the payment will appear as pending until it is authorized."
shipment_mailer:
shipped_email:
dear_customer: "Dear Customer,"
instructions: "Your order from %{distributor} has been shipped"
shipment_summary: "Shipment Summary"
subject: "Shipment Notification"
thanks: "Thank you for your business."
track_information: ! "Tracking Information: %{tracking}"
track_link: ! "Tracking Link: %{url}"
picked_up_instructions: "Your order from %{distributor} has been picked-up"
picked_up_subject: "Pick up Notification"
test_mailer:
test_email:

View File

@@ -42,13 +42,12 @@ RSpec.describe Spree::ShipmentMailer do
it "includes the distributor's name in the body" do
shipment_email = Spree::ShipmentMailer.shipped_email(shipment, delivery: true)
expect(shipment_email.body).to include("Your order from #{distributor.name} has been shipped")
expect(shipment_email.body).to include("Your order from <strong>#{distributor.name}</strong> has been shipped")
end
it "picked_up email includes different text in body" do
text = "Your order from #{distributor.name} has been picked-up"
picked_up_email = Spree::ShipmentMailer.shipped_email(shipment, delivery: false)
expect(picked_up_email.body).to include(text)
expect(picked_up_email.body).to include("Your order from <strong>#{distributor.name}</strong> has been picked-up")
end
it "picked_up email has different subject" do