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

pulibrary / orangelight / 0e37073d-109c-440c-949f-49d2aa86311b

18 Aug 2025 09:05PM UTC coverage: 0.482% (-94.9%) from 95.343%
0e37073d-109c-440c-949f-49d2aa86311b

push

circleci

web-flow
Replace per_page_options_for_select with custom component to avoid deprecation issue (#5186)

* Start creating new component to address deprecaton warning

* Replace per_page_options_for_select with custom component to avoid deprecation issue

Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>

---------

Co-authored-by: Ryan Jensen <rj1044@princeton.edu>
Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>

0 of 33 new or added lines in 1 file covered. (0.0%)

9374 existing lines in 213 files now uncovered.

47 of 9753 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/components/holdings/online_holdings_component.rb
1
# frozen_string_literal: true
2

3
# This component is responsible for displaying a brief description of
4
# a document's online holdings for consice contexts like the search
5
# results page
UNCOV
6
class Holdings::OnlineHoldingsComponent < ViewComponent::Base
×
UNCOV
7
  def initialize(document:)
×
UNCOV
8
    @document = document
×
UNCOV
9
  end
×
10

UNCOV
11
  def render?
×
UNCOV
12
    links.present?
×
UNCOV
13
  end
×
14

UNCOV
15
  private
×
16

UNCOV
17
    attr_reader :document
×
18

UNCOV
19
    def links
×
UNCOV
20
      @links ||= marc_links + portfolio_links
×
UNCOV
21
    end
×
22

23
    # Generate an Array of <div> elements wrapping links to proxied service endpoints for access
24
    # Takes first 2 links for pairing with online holdings in search results
25
    # @return [Array<String>] array containing the links in the <div>'s
26
    # :reek:FeatureEnvy
UNCOV
27
    def marc_links
×
UNCOV
28
      electronic_access = document['electronic_access_1display']
×
UNCOV
29
      urls = []
×
UNCOV
30
      if electronic_access
×
UNCOV
31
        links_hash = JSON.parse(electronic_access)
×
UNCOV
32
        links_hash.first(2).each do |url, text|
×
UNCOV
33
          description = text[1] ? "#{text[1]}: #{text[0]}" : text[0]
×
UNCOV
34
          urls << { "url" => url, "title" => description }.to_json
×
UNCOV
35
        end
×
UNCOV
36
      end
×
UNCOV
37
      urls
×
UNCOV
38
    end
×
39

40
    # Returns electronic portfolio links for Alma records.
41
    # @return [Array<String>] array containing the links
UNCOV
42
    def portfolio_links
×
UNCOV
43
      return [] if document.try(:electronic_portfolios).blank?
×
UNCOV
44
      document.electronic_portfolios.map(&:to_json)
×
UNCOV
45
    end
×
UNCOV
46
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