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

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/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
UNCOV
5
class PhysicalHoldingsMarkupBuilder < HoldingRequestsBuilder
×
UNCOV
6
  include ApplicationHelper
×
7

UNCOV
8
  attr_reader :adapter
×
UNCOV
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]
UNCOV
14
  def initialize(adapter, params = ActionController::Parameters.new)
×
UNCOV
15
    @adapter = adapter
×
UNCOV
16
    @params = params.permit(:open_holdings)
×
UNCOV
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
UNCOV
21
  def build
×
UNCOV
22
    physical_holdings_block
×
UNCOV
23
  end
×
24

UNCOV
25
  private
×
26

UNCOV
27
    attr_reader :params
×
28

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

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

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

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

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