Sha256: 21b3dbabaca9e2e7addedd9b27ac1a22bcb2e2606c21fb897dcb200d459b9657

Contents?: true

Size: 1.08 KB

Versions: 34

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true
# Only works for documents with a #to_marc right now.
class RecordMailer < ActionMailer::Base
  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: "")
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
blacklight-7.40.0 app/models/record_mailer.rb
blacklight-7.39.0 app/models/record_mailer.rb
blacklight-7.38.0 app/models/record_mailer.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/app/models/record_mailer.rb
blacklight-7.37.0 app/models/record_mailer.rb
blacklight-7.36.2 app/models/record_mailer.rb
blacklight-7.36.1 app/models/record_mailer.rb
blacklight-7.36.0 app/models/record_mailer.rb
blacklight-7.35.0 app/models/record_mailer.rb
blacklight-7.34.0 app/models/record_mailer.rb
blacklight-7.33.1 app/models/record_mailer.rb
blacklight-7.33.0 app/models/record_mailer.rb
blacklight-7.32.0 app/models/record_mailer.rb
blacklight-7.31.0 app/models/record_mailer.rb
blacklight-7.30.0 app/models/record_mailer.rb
blacklight-7.29.0 app/models/record_mailer.rb
blacklight-7.28.0 app/models/record_mailer.rb
blacklight-7.27.1 app/models/record_mailer.rb
blacklight-7.27.0 app/models/record_mailer.rb
blacklight-7.26.1 app/models/record_mailer.rb