Sha256: fa71c7b6941f231ba87b9d96a165ef0d430ed2117ab9993255d59c83afc66269

Contents?: true

Size: 646 Bytes

Versions: 36

Compression:

Stored size: 646 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class NewsletterMailer < ApplicationMailer
    add_template_helper Decidim::TranslationsHelper

    def newsletter(user, newsletter)
      @organization = user.organization
      @newsletter = newsletter

      with_user(user) do
        @subject = parse_interpolations(@newsletter.subject[I18n.locale.to_s], user)
        @body = parse_interpolations(@newsletter.body[I18n.locale.to_s], user)

        mail(to: "#{user.name} <#{user.email}>", subject: @subject)
      end
    end

    private

    def parse_interpolations(content, user)
      content.gsub("%{name}", user.name)
    end
  end
end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
decidim-core-0.7.4 app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.7.3 app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.7.2 app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.7.1 app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.7.0 app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.6.8 app/mailers/decidim/newsletter_mailer.rb
decidim-0.6.8 decidim-core/app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.6.7 app/mailers/decidim/newsletter_mailer.rb
decidim-0.6.7 decidim-core/app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.6.6 app/mailers/decidim/newsletter_mailer.rb
decidim-0.6.6 decidim-core/app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.6.5 app/mailers/decidim/newsletter_mailer.rb
decidim-0.6.5 decidim-core/app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.6.4 app/mailers/decidim/newsletter_mailer.rb
decidim-0.6.4 decidim-core/app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.6.3 app/mailers/decidim/newsletter_mailer.rb
decidim-0.6.3 decidim-core/app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.6.2 app/mailers/decidim/newsletter_mailer.rb
decidim-0.6.2 decidim-core/app/mailers/decidim/newsletter_mailer.rb
decidim-core-0.6.1 app/mailers/decidim/newsletter_mailer.rb