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

pulibrary / orangelight / 4c391e0e-519a-40cb-8ad3-354445f4ce03

12 Aug 2025 08:47PM UTC coverage: 85.348% (-10.0%) from 95.335%
4c391e0e-519a-40cb-8ad3-354445f4ce03

push

circleci

web-flow
[#5143] Use access restriction note as Aeon ItemInfo1 if available (#5173)

With this commit, if a user visits a record with an access
restrictions note and presses the Reading Room Request
button, they will get to an Aeon form with the 'Restrictions'
field pre-filled with the restriction note.

If the record does not have an access restrictions note,
the field will be pre-filled with 'Reading Room Access Only',
as it has been previously.

Closes #5143

5493 of 6436 relevant lines covered (85.35%)

251.82 hits per line

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

54.55
/app/models/concerns/blacklight/document/dublin_core.rb
1
# frozen_string_literal: true
2

3
require 'builder'
1✔
4
# This module provide Dublin Core export based on the document's semantic values
5
module Blacklight
1✔
6
  module Document
1✔
7
    module DublinCore
1✔
8
      def self.extended(document)
1✔
9
        # Register our exportable formats
10
        Blacklight::Document::DublinCore.register_export_formats(document)
752✔
11
      end
12

13
      def self.register_export_formats(document)
1✔
14
        document.will_export_as(:xml)
752✔
15
        document.will_export_as(:dc_xml, 'text/xml')
752✔
16
        document.will_export_as(:oai_dc_xml, 'text/xml')
752✔
17
        document.will_export_as(:rdf_dc, 'text/xml')
752✔
18
      end
19

20
      def dublin_core_field_names
1✔
21
        %i[contributor coverage creator date description format
×
22
           identifier language publisher relation rights source
23
           subject title type]
24
      end
25

26
      # dublin core elements are mapped against the #dublin_core_field_names whitelist.
27
      def export_as_oai_dc_xml
1✔
28
        xml = Builder::XmlMarkup.new
×
29
        xml.tag!('oai_dc:dc',
×
30
                 'xmlns:oai_dc' => 'http://www.openarchives.org/OAI/2.0/oai_dc/',
31
                 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
32
                 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
33
                 'xsi:schemaLocation' => %(http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd)) do
34
          to_semantic_values.select { |field, _values| dublin_core_field_name? field }.each do |field, values|
×
35
            Array.wrap(values).each do |v|
×
36
              xml.tag! "dc:#{field}", v
×
37
            end
38
          end
39
        end
40
        xml.target!
×
41
      end
42

43
      def export_as_rdf_dc
1✔
44
        xml = Builder::XmlMarkup.new
×
45
        xml.tag!('rdf:RDF',
×
46
                 'xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
47
                 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
48
                 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance') do
49
          xml.tag!('rdf:Description', 'rdf:about' => "https://catalog.princeton.edu/catalog/#{id}") do
×
50
            to_semantic_values.select { |field, _values| dublin_core_field_name? field }.each do |field, values|
×
51
              Array.wrap(values).each do |v|
×
52
                xml.tag! "dc:#{field}", v
×
53
              end
54
            end
55
          end
56
        end
57
        xml.target!
×
58
      end
59

60
      alias export_as_xml export_as_oai_dc_xml
1✔
61
      alias export_as_dc_xml export_as_oai_dc_xml
1✔
62

63
      private
1✔
64

65
        def dublin_core_field_name?(field)
1✔
66
          dublin_core_field_names.include? field.to_sym
×
67
        end
68
    end
69
  end
70
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