• 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

86.05
/app/helpers/catalog_helper.rb
1
# frozen_string_literal: true
2

3
module CatalogHelper
1✔
4
  include Blacklight::CatalogHelperBehavior
1✔
5

6
  ##
7
  # Get the classes to add to a document's div
8
  #
9
  # @return [String]
10
  def render_document_class(document = @document)
1✔
11
    types = document_types(document)
251✔
12
    return if types.blank?
251✔
13
    type = types.first
245✔
14
    "#{document_class_prefix}#{type.try(:parameterize) || type}"
245✔
15
  end
16

17
  # Determine whether or not to render the availability
18
  #
19
  # @return [TrueClass, FalseClass]
20
  def render_availability?
1✔
21
    !request.bot?
436✔
22
  end
23

24
  # @see Blacklight::CatalogHelperBehavior#render_search_to_page_title_filter
25
  # @param [facet]
26
  # @param [values]
27
  def render_search_to_page_title_filter(facet, values)
1✔
28
    return '' if values.blank?
10✔
29
    super(facet, values)
10✔
30
  end
31

32
  # @see Blacklight::CatalogHelperBehavior#render_search_to_page_title
33
  # @param [params]
34
  def render_search_to_page_title(params)
1✔
35
    constraints = []
36✔
36

37
    if params['q'].present?
36✔
38
      q_label = label_for_search_field(params[:search_field]) unless blacklight_config.default_search_field && params[:search_field] == blacklight_config.default_search_field[:key]
8✔
39

40
      constraints += if q_label.present?
8✔
41
                       [t('blacklight.search.page_title.constraint', label: q_label, value: params['q'])]
×
42
                     else
43
                       [params['q']]
8✔
44
                     end
45
    end
46

47
    if params['f'].present?
36✔
48
      new_constraints = params['f'].to_unsafe_h.collect { |key, value| render_search_to_page_title_filter(key, value) }
15✔
49
      constraints += new_constraints.reject(&:empty?)
5✔
50
    end
51

52
    constraints.join(' / ')
36✔
53
  end
54

55
  def render_top_field?(document, field_name)
1✔
56
    document[field_name].present? && top_field?(document, field_name)
5,336✔
57
  end
58

59
  def ejournals_path
1✔
60
    params = search_state.params_for_search({ f: { access_facet: %w[Online], format: %w[Journal] } }).except(:model)
3✔
61
    Rails.application.routes.url_helpers.url_for controller: 'catalog', params:, only_path: true
3✔
62
  end
63

64
  def search_algorithm_value
1✔
65
    if params[:search_algorithm] == "engineering"
×
66
      "engineering"
×
67
    else
68
      "default"
×
69
    end
70
  end
71

72
  private
1✔
73

74
    def document_types(document)
1✔
75
      document[blacklight_config.view_config(document_index_view_type).display_type_field]
251✔
76
    end
77

78
    def top_field?(document, field)
1✔
79
      if document.numismatics_record?
334✔
80
        coin_top_field?(field) || false
×
81
      else
82
        default_top_field?(field) || false
334✔
83
      end
84
    end
85

86
    def default_top_field?(field)
1✔
87
      blacklight_config.show_fields[field]&.default_top_field
334✔
88
    end
89

90
    def coin_top_field?(field)
1✔
91
      blacklight_config.show_fields[field]&.coin_top_field
×
92
    end
93
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