Class: RecordMailer

Inherits:
ApplicationMailer
  • Object
show all
Defined in:
app/models/record_mailer.rb

Overview

Only works for documents with a #to_marc right now.

Instance Method Summary collapse

Instance Method Details

#blacklight_configObject



31
32
33
# File 'app/models/record_mailer.rb', line 31

def blacklight_config
  @config || Blacklight.default_configuration
end

#blacklight_configuration_contextObject

Context in which to evaluate blacklight configuration conditionals



37
38
39
# File 'app/models/record_mailer.rb', line 37

def blacklight_configuration_context
  @blacklight_configuration_context ||= Blacklight::Configuration::Context.new(self)
end

#email_record(documents, details, url_gen_params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/record_mailer.rb', line 8

def email_record(documents, details, url_gen_params)
  @documents      = documents
  @message        = details[:message]
  @config         = details[:config]
  @url_gen_params = url_gen_params

  title = view_context.document_presenter(documents.first).html_title || I18n.t('blacklight.email.text.default_title')

  subject = I18n.t('blacklight.email.text.subject',
                   count: documents.length,
                   title: Array(title).first)

  mail(to: details[:to], subject: subject)
end

#sms_record(documents, details, url_gen_params) ⇒ Object



23
24
25
26
27
28
29
# File 'app/models/record_mailer.rb', line 23

def sms_record(documents, details, url_gen_params)
  @documents      = documents
  @config         = details[:config]
  @url_gen_params = url_gen_params

  mail(to: details[:to], subject: "") # rubocop:disable Rails/I18nLocaleTexts
end