mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
DRYing out standing order email template
This commit is contained in:
@@ -47,6 +47,6 @@ class StandingOrderPlacementJob
|
||||
end
|
||||
|
||||
def send_placement_email(order, changes)
|
||||
Spree::OrderMailer.standing_order_placement_email(order, changes).deliver
|
||||
Spree::OrderMailer.standing_order_email(order, 'placement', changes).deliver
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,7 +39,8 @@ Spree::OrderMailer.class_eval do
|
||||
:reply_to => @order.distributor.contact.email)
|
||||
end
|
||||
|
||||
def standing_order_placement_email(order, changes)
|
||||
def standing_order_email(order, type, changes)
|
||||
@type = type
|
||||
@changes = changes
|
||||
find_order(order) # Finds an order instance from an id
|
||||
subject = "#{Spree::Config[:site_name]} #{t('order_mailer.confirm_email.subject')} ##{@order.number}"
|
||||
|
||||
@@ -7,22 +7,29 @@
|
||||
%h3
|
||||
= t :email_confirm_customer_greeting, name: @order.bill_address.firstname
|
||||
%h4
|
||||
= t :email_placement_intro_html, distributor: @order.distributor.name
|
||||
- if @order.paid?
|
||||
= t :email_so_payment_success_intro_html, distributor: @order.distributor.name
|
||||
- else
|
||||
= t("email_so_#{@type}_intro_html", distributor: @order.distributor.name)
|
||||
%table.column{:align => "left"}
|
||||
%tr
|
||||
%td{:align => "right"}
|
||||
%img.float-right{:src => "#{@order.distributor.logo.url(:medium)}"}/
|
||||
%span.clear
|
||||
|
||||
%p.callout
|
||||
= t("email_so_explainer_html", orders_close_at: l(@order.order_cycle.orders_close_at, format: "%a %b %d @ %I%p"))
|
||||
= t("email_so_contact_distributor_html", distributor: @order.distributor.name, email: @order.distributor.email)
|
||||
|
||||
%p
|
||||
%h4
|
||||
= t :email_confirm_customer_number_html, number: @order.number
|
||||
%p
|
||||
= t :email_placement_details_html, distributor: @order.distributor.name
|
||||
= t("email_so_#{@type}_details_html", distributor: @order.distributor.name)
|
||||
|
||||
- if @changes.any?
|
||||
%p.callout
|
||||
= t :email_placement_changes
|
||||
= t("email_so_#{type}_changes")
|
||||
= render 'order_summary'
|
||||
= render 'payment'
|
||||
= render 'shipping'
|
||||
@@ -1165,9 +1165,14 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
email_payment_not_paid: NOT PAID
|
||||
email_payment_summary: Payment summary
|
||||
email_payment_method: "Paying via:"
|
||||
email_placement_intro_html: "This email is to notify you that an order has been automatically placed with <strong>%{distributor}</strong> on your behalf."
|
||||
email_placement_details_html: "Here are the details of your order for <strong>%{distributor}</strong>:"
|
||||
email_placement_changes: "Unfortunately, not all products that you requested were available. The original quantities that you requested appear crossed-out below."
|
||||
email_so_placement_intro_html: "You have a new order with <strong>%{distributor}</strong>"
|
||||
email_so_placement_details_html: "Here are the details of your order for <strong>%{distributor}</strong>:"
|
||||
email_so_placement_changes: "Unfortunately, not all products that you requested were available. The original quantities that you requested appear crossed-out below."
|
||||
email_so_payment_success_intro_html: "An automatic payment has been processed for your order from <strong>%{distributor}</strong>."
|
||||
email_so_explainer_html: "This order was automatically created on your behalf. You can make changes until orders close on %{orders_close_at}."
|
||||
email_so_contact_distributor_html: "If you have any questions you can contact <strong>%{distributor}</strong> via %{email}."
|
||||
email_so_confirmation_intro_html: "Your order with <strong>%{distributor}</strong> is now confirmed"
|
||||
email_so_confirmation_details_html: "Here's everything you need to know about your order from <strong>%{distributor}</strong>:"
|
||||
email_shipping_delivery_details: Delivery details
|
||||
email_shipping_delivery_time: "Delivery on:"
|
||||
email_shipping_delivery_address: "Delivery address:"
|
||||
|
||||
Reference in New Issue
Block a user