Class: Decidim::Budgets::OrderSummaryMailer

Inherits:
ApplicationMailer show all
Includes:
SanitizeHelper, TranslationsHelper
Defined in:
decidim-budgets/app/mailers/decidim/budgets/order_summary_mailer.rb

Instance Method Summary collapse

Methods included from SanitizeHelper

#decidim_html_escape, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_url_escape, included

Methods included from TranslationsHelper

empty_translatable, ensure_translatable, multi_translation, translated_in_current_locale?

Methods included from TranslatableAttributes

#default_locale?

Instance Method Details

#order_summary(order) ⇒ Object

Send an email to an user with the summary of the order.

order - the order that was just created



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'decidim-budgets/app/mailers/decidim/budgets/order_summary_mailer.rb', line 14

def order_summary(order)
  user = order.user

  with_user(user) do
    @user = user
    @order = order
    @budget = order.budget
    @space = order.budget.participatory_space
    @component = order.budget.component
    @organization = order.budget.participatory_space.organization

    subject = I18n.t(
      "order_summary.subject",
      scope: "decidim.budgets.order_summary_mailer",
      budget_name: translated_attribute(@budget.title),
      space_name: translated_attribute(@space.title)
    )
    mail(to: user.email, subject:)
  end
end