Sha256: 985daf335dad530d448f1050f0d7acc74d5faf1ac28129f832e2510f21c7f598

Contents?: true

Size: 1.27 KB

Versions: 11

Compression:

Stored size: 1.27 KB

Contents

module Alchemy
  class AjaxFormsMailer < ApplicationMailer

    if Alchemy::Ajax::Form.enable_mjml
      layout "alchemy/mjml_base_mailer"
    else
      layout "alchemy/base_mailer"
    end


    include Alchemy::ConfigurationMethods
    add_template_helper(Alchemy::PagesHelper)


    def notify_message(r)
      @rec = r
      reply_to = @rec.email if @rec.respond_to? :email
      if Alchemy::Ajax::Form.enable_mjml
        mail(from: Alchemy::EMAIL_NOTIFY_FROM, to: r.emails_recipient, subject: r.notify_subject, reply_to: reply_to) do |format|
          format.mjml { render "mjml_notify_message", locals: {recipient: @rec} }
        end
      else
        mail(from: Alchemy::EMAIL_NOTIFY_FROM, to: r.emails_recipient, subject: r.notify_subject, reply_to: reply_to)
      end
    end

    def notify_message_user(r)
      @rec = r
      if Alchemy::Ajax::Form.enable_mjml
        mail(to: @rec.email, from: Alchemy::EMAIL_NOTIFY_FROM, subject: @rec.notify_user_subject) do |format|
          format.mjml { render "mjml_notify_user_message", locals: {recipient: @rec} }
        end
      else
        mail(to: @rec.email, from: Alchemy::EMAIL_NOTIFY_FROM, subject: @rec.notify_user_subject) do |format|
          format.html {render "notify_user_message"}
        end
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
alchemy-ajax-form-1.2.1 app/mailers/alchemy/ajax_forms_mailer.rb
alchemy-ajax-form-2.1.0 app/mailers/alchemy/ajax_forms_mailer.rb
alchemy-ajax-form-2.0.0 app/mailers/alchemy/ajax_forms_mailer.rb
alchemy-ajax-form-1.2.0 app/mailers/alchemy/ajax_forms_mailer.rb
alchemy-ajax-form-1.1.5 app/mailers/alchemy/ajax_forms_mailer.rb
alchemy-ajax-form-1.1.3 app/mailers/alchemy/ajax_forms_mailer.rb
alchemy-ajax-form-1.1.2 app/mailers/alchemy/ajax_forms_mailer.rb
alchemy-ajax-form-1.1.1 app/mailers/alchemy/ajax_forms_mailer.rb
alchemy-ajax-form-1.1.0 app/mailers/alchemy/ajax_forms_mailer.rb
alchemy-ajax-form-1.0.1 app/mailers/alchemy/ajax_forms_mailer.rb
alchemy-ajax-form-1.0.0 app/mailers/alchemy/ajax_forms_mailer.rb