Sha256: 4ec78fc27f36f3b693515302a4d2e9b3a8cdbbdbb66a7efc27e71d33a6d9c358

Contents?: true

Size: 1.15 KB

Versions: 28

Compression:

Stored size: 1.15 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 configatron.enju.web_port_number != 80
  else
    default_url_options[:host] = configatron.enju.web_hostname
    default_url_options[:port] = configatron.enju.web_port_number if configatron.enju.web_port_number != 80
  end

  def message_notification(message)
    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
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
enju_message-0.0.25 spec/dummy/app/mailers/notifier.rb
enju_message-0.1.9 spec/dummy/app/mailers/notifier.rb
enju_message-0.0.24 spec/dummy/app/mailers/notifier.rb
enju_message-0.1.8 spec/dummy/app/mailers/notifier.rb
enju_message-0.0.23 spec/dummy/app/mailers/notifier.rb
enju_message-0.1.7 spec/dummy/app/mailers/notifier.rb
enju_message-0.0.22 spec/dummy/app/mailers/notifier.rb
enju_message-0.1.6 spec/dummy/app/mailers/notifier.rb
enju_message-0.0.21 spec/dummy/app/mailers/notifier.rb
enju_message-0.1.5 spec/dummy/app/mailers/notifier.rb
enju_message-0.0.20 spec/dummy/app/mailers/notifier.rb
enju_message-0.1.4 spec/dummy/app/mailers/notifier.rb
enju_message-0.1.3 spec/dummy/app/mailers/notifier.rb
enju_message-0.1.2 spec/dummy/app/mailers/notifier.rb
enju_message-0.0.19 spec/dummy/app/mailers/notifier.rb
enju_message-0.1.1 spec/dummy/app/mailers/notifier.rb
enju_message-0.1.0 spec/dummy/app/mailers/notifier.rb
enju_message-0.0.18 spec/dummy/app/mailers/notifier.rb
enju_message-0.0.17 spec/dummy/app/mailers/notifier.rb
enju_message-0.0.16 spec/dummy/app/mailers/notifier.rb