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

pulibrary / orangelight / 00dbc10b-d747-4ad7-b211-7b26d753abbb

14 Aug 2025 01:25PM UTC coverage: 0.483% (-94.9%) from 95.343%
00dbc10b-d747-4ad7-b211-7b26d753abbb

push

circleci

web-flow
Merge pull request #5181 from pulibrary/dependabot/bundler/activestorage-7.2.2.2

Bump activestorage from 7.2.2.1 to 7.2.2.2

47 of 9721 relevant lines covered (0.48%)

0.01 hits per line

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

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

3
module CatalogHelper
×
4
  include Blacklight::CatalogHelperBehavior
×
5

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

17
  # Determine whether or not to render the availability
18
  #
19
  # @return [TrueClass, FalseClass]
20
  def render_availability?
×
21
    !request.bot?
×
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)
×
28
    return '' if values.blank?
×
29
    super(facet, values)
×
30
  end
×
31

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

37
    if params['q'].present?
×
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]
×
39

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

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

52
    constraints.join(' / ')
×
53
  end
×
54

55
  def render_top_field?(document, field_name)
×
56
    document[field_name].present? && top_field?(document, field_name)
×
57
  end
×
58

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

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

72
  private
×
73

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

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

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

90
    def coin_top_field?(field)
×
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