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

pulibrary / orangelight / c2125dbb-7dcc-4c32-b80f-bb2440489569

25 Aug 2025 07:36PM UTC coverage: 95.356% (-0.005%) from 95.361%
c2125dbb-7dcc-4c32-b80f-bb2440489569

Pull #5197

circleci

christinach
Build a viewer_component to render the iif viewer for the ephemera resources
related to [#4886]
Pull Request #5197: Build a viewer_component to render the iif viewer for the ephemera resources

14 of 15 new or added lines in 1 file covered. (93.33%)

6 existing lines in 1 file now uncovered.

6181 of 6482 relevant lines covered (95.36%)

1500.24 hits per line

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

93.33
/app/components/viewer_component.rb
1
##
2
# ViewerComponent
3
#
4
# This component is responsible for rendering a viewer for ephemera items using IIIF manifests.
5
# It expects an `electronic_access_1display` parameter containing JSON with IIIF manifest paths.
6
# The component extracts the ephemera manifest URL for use in the view.
7
#
8
# Example usage:
9
#   render(ViewerComponent.new(electronic_access_1display: ...))
10
#
11
# The manifest_url method returns the IIIF manifest URL for the ephemera item, or nil if not available.
12
#
13
# frozen_string_literal: true
14
class ViewerComponent < ViewComponent::Base
3✔
15
  require 'json'
3✔
16

17
  def initialize(electronic_access_1display:)
3✔
18
    @electronic_access_1display = electronic_access_1display
108✔
19
  end
20

21
  def manifest_url
3✔
22
    return nil if @electronic_access_1display.blank?
108✔
23
    return unless iiif_manifest_paths && iiif_manifest_paths_ephemera_ark
31✔
NEW
24
    iiif_manifest_paths_ephemera_ark
×
25
  end
26

27
  private
3✔
28

29
    def iiif_manifest_paths
3✔
30
      return {} if @electronic_access_1display.blank?
41✔
31
      data = JSON.parse(@electronic_access_1display)
41✔
32
      data['iiif_manifest_paths']
41✔
33
    end
34

35
    def iiif_manifest_paths_ephemera_ark
3✔
36
      iiif_manifest_paths['ephemera_ark']
10✔
37
    end
38
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