Sha256: 40c38ab157bc246b5075b1031dd0ba829293c9c46c78e7e7fa861f6816ef6a22

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

class Notifier < ActionMailer::Base
  include Resque::Mailer

  def message_notification(message_id)
    message = Message.find(message_id)
    I18n.locale = message.receiver.locale.try(:to_sym) || I18n.default_locale
    from = "#{LibraryGroup.system_name(message.receiver.locale)} <#{LibraryGroup.site_config.email}>"
    if message.subject
      subject = message.subject
    else
      subject = I18n.t('message.new_message_from_library', :library => LibraryGroup.system_name(message.receiver.user.locale))
    end
    if message.sender
      @sender_name = message.sender.patron.full_name
    else
      @sender_name = LibraryGroup.system_name(message.receiver.locale)
    end
    @message = message
    @locale = message.receiver.locale
    mail(:from => from, :to => message.receiver.email, :subject => subject)
  end

  def manifestation_info(user_id, manifestation_id)
    user = User.find(user_id)
    manifestation = Manifestation.find(manifestation_id)
    from = "#{LibraryGroup.system_name(user.locale)} <#{LibraryGroup.site_config.email}>"
    subject = "#{manifestation.original_title} : #{LibraryGroup.system_name(user.locale)}"
    @user = user
    @manifestation = manifestation
    mail(:from => from, :to => user.email, :subject => subject)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
enju_leaf-1.1.0.rc4 app/mailers/notifier.rb
enju_leaf-1.1.0.rc3 app/mailers/notifier.rb
enju_leaf-1.1.0.rc2 app/mailers/notifier.rb