Sha256: d51060e00bdd9ae4f6a42f443bece53027396bfa374e41d8b41578eb605ec637

Contents?: true

Size: 1.1 KB

Versions: 18

Compression:

Stored size: 1.1 KB

Contents

class Notifier < ActionMailer::Base
  if LibraryGroup.site_config.try(:url)
    uri = Addressable::URI.parse(LibraryGroup.site_config.url)
    default_url_options[:host] = uri.host
    default_url_options[:port] = uri.port if Setting.enju.web_port_number != 80
  else
    default_url_options[:host] = Setting.enju.web_hostname
    default_url_options[:port] = Setting.enju.web_port_number if Setting.enju.web_port_number != 80
  end

  def message_notification(message)
    I18n.locale = message.receiver.locale.to_sym
    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
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
enju_event-0.1.17.pre18 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre17 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre16 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre15 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre14 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre13 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre12 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre11 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre10 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre9 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre8 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre7 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre6 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre5 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre4 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre3 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre2 spec/dummy/app/mailers/notifier.rb
enju_event-0.1.17.pre spec/dummy/app/mailers/notifier.rb