• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / orangelight / 24016876-b24d-4304-a82e-b49d0755d6cd

11 Dec 2024 06:24PM UTC coverage: 95.834% (-0.6%) from 96.407%
24016876-b24d-4304-a82e-b49d0755d6cd

Pull #4582

circleci

christinach
Fix cancel button for feedback forms

Closes #4570
Pull Request #4582: Blacklight upgrade to 8.6.1

6004 of 6265 relevant lines covered (95.83%)

1516.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/models/concerns/blacklight/document/email.rb
1
# frozen_string_literal: true
2

3
# This module provides the body of an email export based on the document's semantic values
4
module Blacklight
×
5
  module Document
×
6
    module Email
×
7
      include ActionView::Helpers::UrlHelper
×
8
      # Return a text string that will be the body of the email
9
      def to_email_text
×
10
        body = []
×
11
        add_bibliographic_text(body)
×
12
        add_online_text(body, self[:electronic_access_1display])
×
13
        body.join("\n") unless body.empty?
×
14
      end
×
15

16
      private
×
17

18
        def add_single_valued_field(body, i18_label, value)
×
19
          body << I18n.t(i18_label, value:) if value.present?
×
20
        end
×
21

22
        def add_multi_valued_field(body, i18_label, value)
×
23
          value.each { |v| add_single_valued_field(body, i18_label, v) } if value.present?
×
24
        end
×
25

26
        def add_bibliographic_text(body)
×
27
          add_single_valued_field(body, 'blacklight.email.text.title', self[:title_vern_display])
×
28
          add_single_valued_field(body, 'blacklight.email.text.title', self[:title_display])
×
29
          add_multi_valued_field(body, 'blacklight.email.text.author', self[:author_display])
×
30
          add_multi_valued_field(body, 'blacklight.email.text.publish', self[:pub_created_display])
×
31
          add_multi_valued_field(body, 'blacklight.email.text.format', self[:format])
×
32
        end
×
33

34
        def add_online_text(body, links_field)
×
35
          if links_field.present?
×
36
            body << I18n.t('blacklight.email.text.online')
×
37
            links = JSON.parse(links_field)
×
38
            links.each do |url, text|
×
39
              link = "#{text[0]}: #{url}"
×
40
              link = "#{text[1]} - " + link if text[1]
×
41
              body << "\t" + link
×
42
            end
×
43
          end
×
44
        end
×
45
    end
×
46
  end
×
47
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc