Sha256: 52ad15bbc2be47fec7ddb787f87ecd179ffa953d5ce506d8a947a5daead6acf3

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

# Only works for documents with a #to_marc right now.
class RecordMailer < ApplicationMailer
  def email_record(documents, details, url_gen_params)
    title = begin
      title_field = details[:config].email.title_field
      if title_field
        [documents.first[title_field]].flatten.first
      else
        documents.first.to_semantic_values[:title]
      end
    rescue
      I18n.t('blacklight.email.text.default_title')
    end

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

    @documents      = documents
    @message        = details[:message]
    @config         = details[:config]
    @url_gen_params = url_gen_params

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

  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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-8.0.0.beta4 app/models/record_mailer.rb
blacklight-8.0.0.beta3 app/models/record_mailer.rb
blacklight-8.0.0.beta2 app/models/record_mailer.rb
blacklight-8.0.0.beta1 app/models/record_mailer.rb