Sha256: 5964a7ad3808fb571a8f98d3e41cfcf32e1073920b5ce86467c747d32a3017a2

Contents?: true

Size: 1.63 KB

Versions: 52

Compression:

Stored size: 1.63 KB

Contents

class Notifier < ActionMailer::Base
  include Resque::Mailer
  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_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

52 entries across 52 versions & 3 rubygems

Version Path
enju_flower-0.1.0.pre11 spec/dummy/app/mailers/notifier.rb
enju_flower-0.1.0.pre10 spec/dummy/app/mailers/notifier.rb
enju_biblio-0.1.0.pre42 spec/dummy/app/mailers/notifier.rb
enju_biblio-0.1.0.pre41 spec/dummy/app/mailers/notifier.rb
enju_flower-0.1.0.pre9 spec/dummy/app/mailers/notifier.rb
enju_biblio-0.1.0.pre40 spec/dummy/app/mailers/notifier.rb
enju_biblio-0.1.0.pre39 spec/dummy/app/mailers/notifier.rb
enju_flower-0.1.0.pre8 spec/dummy/app/mailers/notifier.rb
enju_biblio-0.1.0.pre38 spec/dummy/app/mailers/notifier.rb
enju_flower-0.1.0.pre7 spec/dummy/app/mailers/notifier.rb
enju_biblio-0.1.0.pre37 spec/dummy/app/mailers/notifier.rb
enju_flower-0.1.0.pre6 spec/dummy/app/mailers/notifier.rb
enju_biblio-0.1.0.pre36 spec/dummy/app/mailers/notifier.rb
enju_biblio-0.1.0.pre35 spec/dummy/app/mailers/notifier.rb
enju_biblio-0.1.0.pre34 spec/dummy/app/mailers/notifier.rb
enju_flower-0.1.0.pre5 spec/dummy/app/mailers/notifier.rb
enju_biblio-0.1.0.pre33 spec/dummy/app/mailers/notifier.rb
enju_biblio-0.1.0.pre32 spec/dummy/app/mailers/notifier.rb
enju_leaf-1.1.0.rc1 app/mailers/notifier.rb
enju_flower-0.1.0.pre4 spec/dummy/app/mailers/notifier.rb