Sha256: a81814e7fc0f9633486fe8a875433c2c282e438d7c92b2fc5bf517e24c97f463

Contents?: true

Size: 1.17 KB

Versions: 21

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8
module Symphonia
  class Notifier < ApplicationMailer
    # default from: "noreply@host.cz", :host => 'host.cz'

    helper :application
    helper Symphonia::ApplicationHelper

    def mail(headers={}, &block)
      I18n.locale = Symphonia.config[:backend_locale]
      super
    end

    def activation_user(user)
      @user = user
      mail({ to: @user.mail, subject: t(:subject_activation_mail) })
    end

    def user_change_to_active(user)
      @user = user
      mail({ to: @user.mail, subject: 'Váš účet je aktivován' })
    end

    def reset_password_user(user, url)
      @user = user
      @url = url
      mail({ to: @user.mail, subject: t(:subject_reset_password_mail) })
    end

    def user_registered(user)
      @user       = user
      @recipients = Symphonia::User.recipients_for(:notify_after_user_registered).pluck(:mail).uniq
      mail({ to: @recipients, subject: t(:subject_user_registered) }) if @recipients.any?
    end

    def test_mail(user_id = nil)
      @user = Symphonia::User.find_by(id: user_id) || Symphonia::User.active.where(admin: true).first
      mail(to: @user.mail, subject: 'Symphonia testing mail')
    end

  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
symphonia-3.3.2 app/mailers/symphonia/notifier.rb