Sha256: 3f98e01b4f7dffeb2266f4b010e8da40b5d0b1b021c005f45b0d0124a2fdd950

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

module Decidim
  module Lausanne
    module Budgets
      class OrderSummaryMailer < Decidim::ApplicationMailer
        include Decidim::TranslationsHelper
        include Decidim::SanitizeHelper

        helper Decidim::TranslationsHelper

        # Send an email to an user with the summary of the order.
        #
        # order - the order that was just created
        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.lausanne_budgets.order_summary_mailer",
              budget_name: translated_attribute(@budget.title),
              space_name: translated_attribute(@space.title)
            )
            mail(to: user.email, subject: subject)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-lausanne-budgets-0.1.0 app/mailers/decidim/lausanne/budgets/order_summary_mailer.rb