Class: Decidim::Elections::VoteAcceptedMailer

Inherits:
ApplicationMailer show all
Includes:
TranslatableAttributes
Defined in:
decidim-elections/app/mailers/decidim/elections/vote_accepted_mailer.rb

Overview

This mailer sends a notification email with the accepted vote information.

Instance Method Summary collapse

Methods included from TranslatableAttributes

#default_locale?

Instance Method Details

#notification(vote, verify_url, locale = nil) ⇒ Object

Public: Sends a notification email with the accepted vote information when there is no user to notify.

vote - The vote to be notified. verify_url - The url to verify the vote. locale - The locale that will be used for the email content (optional).

Returns nothing.



17
18
19
20
21
22
23
24
25
26
# File 'decidim-elections/app/mailers/decidim/elections/vote_accepted_mailer.rb', line 17

def notification(vote, verify_url, locale = nil)
  @vote = vote
  @verify_url = verify_url
  @organization = vote.election.component.organization

  I18n.with_locale(locale || @organization.default_locale) do
    @election_title = translated_attribute(vote.election.title)
    mail(to: vote.email, subject: I18n.t("votes.accepted_votes.email_subject", scope: "decidim.events.elections", resource_name: @election_title))
  end
end