mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Extract format for order cycle closing in emails
Using a helper for this, but this can be changed to look up a translation key.
This commit is contained in:
8
app/helpers/shop_mail_helper.rb
Normal file
8
app/helpers/shop_mail_helper.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
module ShopMailHelper
|
||||
# Long datetime format string used in emails to customers
|
||||
#
|
||||
# Example: "Fri Aug 31 @ 11:00PM"
|
||||
def mail_long_datetime_format
|
||||
"%a %b %d @ %l:%M%p"
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
class SubscriptionMailer < Spree::BaseMailer
|
||||
helper CheckoutHelper
|
||||
helper ShopMailHelper
|
||||
|
||||
def confirmation_email(order)
|
||||
@type = 'confirmation'
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
%p.callout
|
||||
= t("email_so_confirmation_explainer_html")
|
||||
= t("email_so_edit_false_html",
|
||||
orders_close_at: l(@order.order_cycle.orders_close_at, format: "%a %b %d @ %l:%M%p"),
|
||||
orders_close_at: l(@order.order_cycle.orders_close_at, format: mail_long_datetime_format),
|
||||
order_url: spree.order_url(@order))
|
||||
= t("email_so_contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.contact.email)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
%p.callout
|
||||
= t("email_so_failed_payment_explainer_html", distributor: @order.distributor.name)
|
||||
= t("email_so_edit_false_html",
|
||||
orders_close_at: l(@order.order_cycle.orders_close_at, format: "%a %b %d @ %l:%M%p"),
|
||||
orders_close_at: l(@order.order_cycle.orders_close_at, format: mail_long_datetime_format),
|
||||
order_url: spree.order_url(@order))
|
||||
= t("email_so_contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.contact.email)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
= t("email_so_placement_explainer_html")
|
||||
- allow_changes = !!@order.distributor.allow_order_changes?
|
||||
= t("email_so_edit_#{allow_changes}_html",
|
||||
orders_close_at: l(@order.order_cycle.orders_close_at, format: "%a %b %d @ %l:%M%p"),
|
||||
orders_close_at: l(@order.order_cycle.orders_close_at, format: mail_long_datetime_format),
|
||||
order_url: spree.order_url(@order))
|
||||
= t("email_so_contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.contact.email)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user