Class: Decidim::Initiatives::InitiativesMailer
- Inherits:
-
ApplicationMailer
- Object
- ApplicationMailer
- Decidim::Initiatives::InitiativesMailer
- Includes:
- SanitizeHelper, TranslatableAttributes
- Defined in:
- app/mailers/decidim/initiatives/initiatives_mailer.rb
Overview
Mailer for initiatives engine.
Instance Method Summary collapse
-
#notify_creation(initiative) ⇒ Object
Notifies initiative creation.
-
#notify_progress(initiative, user) ⇒ Object
Notify progress to all initiative subscribers.
-
#notify_state_change(initiative, user) ⇒ Object
Notify changes in state.
-
#notify_validating_request(initiative, user) ⇒ Object
Notify an initiative requesting technical validation.
Instance Method Details
#notify_creation(initiative) ⇒ Object
Notifies initiative creation
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/mailers/decidim/initiatives/initiatives_mailer.rb', line 14 def notify_creation(initiative) return if initiative..email.blank? @initiative = initiative @organization = initiative.organization with_user(initiative.) do @subject = I18n.t( "decidim.initiatives.initiatives_mailer.creation_subject", title: translated_attribute(initiative.title) ) mail(to: "#{initiative..name} <#{initiative..email}>", subject: @subject) end end |
#notify_progress(initiative, user) ⇒ Object
Notify progress to all initiative subscribers.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'app/mailers/decidim/initiatives/initiatives_mailer.rb', line 73 def notify_progress(initiative, user) return if user.email.blank? @organization = initiative.organization @link = initiative_url(initiative, host: @organization.host) with_user(user) do @body = I18n.t( "decidim.initiatives.initiatives_mailer.progress_report_body_for", title: translated_attribute(initiative.title), percentage: initiative.percentage ) @subject = I18n.t( "decidim.initiatives.initiatives_mailer.progress_report_for", title: translated_attribute(initiative.title) ) mail(to: "#{user.name} <#{user.email}>", subject: @subject) end end |
#notify_state_change(initiative, user) ⇒ Object
Notify changes in state
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/mailers/decidim/initiatives/initiatives_mailer.rb', line 30 def notify_state_change(initiative, user) return if user.email.blank? @organization = initiative.organization with_user(user) do @subject = I18n.t( "decidim.initiatives.initiatives_mailer.status_change_for", title: translated_attribute(initiative.title) ) @body = I18n.t( "decidim.initiatives.initiatives_mailer.status_change_body_for", title: translated_attribute(initiative.title), state: I18n.t(initiative.state, scope: "decidim.initiatives.admin_states") ) @link = initiative_url(initiative, host: @organization.host) mail(to: "#{user.name} <#{user.email}>", subject: @subject) end end |
#notify_validating_request(initiative, user) ⇒ Object
Notify an initiative requesting technical validation
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/mailers/decidim/initiatives/initiatives_mailer.rb', line 53 def notify_validating_request(initiative, user) return if user.email.blank? @organization = initiative.organization @link = decidim_admin_initiatives.edit_initiative_url(initiative, host: @organization.host) with_user(user) do @subject = I18n.t( "decidim.initiatives.initiatives_mailer.technical_validation_for", title: translated_attribute(initiative.title) ) @body = I18n.t( "decidim.initiatives.initiatives_mailer.technical_validation_body_for", title: translated_attribute(initiative.title) ) mail(to: "#{user.name} <#{user.email}>", subject: @subject) end end |