• 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/services/physical_holdings_markup_builder.rb
1
# frozen_string_literal: true
2

3
# This builder is responsible for constructing all markup for physical holdings
4
# on the catalog show page
5
class PhysicalHoldingsMarkupBuilder < HoldingRequestsBuilder
×
6
  include ApplicationHelper
×
7

8
  attr_reader :adapter
×
9
  delegate :content_tag, :link_to, to: :class
×
10

11
  # Constructor
12
  # @param adapter [HoldingRequestsAdapter] adapter for the SolrDocument and Bibdata API
13
  # @param params [ActionController::Parameters]
14
  def initialize(adapter, params = ActionController::Parameters.new)
×
15
    @adapter = adapter
×
16
    @params = params.permit(:open_holdings)
×
17
  end
×
18

19
  # Builds the markup for online and physical holdings for a given record
20
  # @return [String] the markup for the physical holdings
21
  def build
×
22
    physical_holdings_block
×
23
  end
×
24

25
  private
×
26

27
    attr_reader :params
×
28

29
    # Generate the markup for physical holdings
30
    # @return [String] the markup
31
    def physical_holdings
×
32
      @adapter.grouped_physical_holdings.each_with_index.map do |group, index|
×
33
        render_component(Holdings::PhysicalHoldingGroupComponent.new(adapter:, group:, open: open_group?(index, group)))
×
34
      end.join
×
35
    end
×
36

37
    # Generate the markup block for physical holdings
38
    # @return [String] the markup
39
    def physical_holdings_block
×
40
      children = physical_holdings
×
41
      if children.empty?
×
42
        ''
×
43
      else
×
44
        self.class.content_tag(:tbody, children.html_safe)
×
45
      end
×
46
    end
×
47

48
    def render_component(component)
×
49
      view_context.render(component)
×
50
    end
×
51

52
    def view_context
×
53
      @view_context ||= ApplicationController.new.view_context
×
54
    end
×
55

56
    def open_group?(index, group)
×
57
      index.zero? || params[:open_holdings] == group.group_name
×
58
    end
×
59
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