From d3d9a4ba008deeba86f44242ca316d037e32e739 Mon Sep 17 00:00:00 2001 From: Christina Chortaria Date: Fri, 4 Oct 2024 16:53:02 -0400 Subject: [PATCH] [#3960] Update holding block in search results to have the same button for partner recap and alma records Move the online content badge above the view record for full availability --- app/helpers/holdings_helper.rb | 16 +++------------- spec/helpers/holding_block_spec.rb | 18 +++++------------- spec/requests/request_spec.rb | 2 +- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/app/helpers/holdings_helper.rb b/app/helpers/holdings_helper.rb index 21a5f9bc5..1aa9193bd 100644 --- a/app/helpers/holdings_helper.rb +++ b/app/helpers/holdings_helper.rb @@ -16,16 +16,14 @@ def holding_block_search(document) block << content_tag(:li, cdl_placeholder) end - if @scsb_multiple == true + block << controller.view_context.render(Holdings::OnlineHoldingsComponent.new(document:)) + + if @scsb_multiple == true || holdings_hash.length > 2 block << view_record_for_full_avail_li(document) - elsif holdings_hash.length > 2 - block << additional_holdings_span elsif !holdings_hash.empty? block << view_record_for_full_avail_li_two(document) end - block << controller.view_context.render(Holdings::OnlineHoldingsComponent.new(document:)) - if block.empty? content_tag(:div, t('blacklight.holdings.search_missing')) else @@ -191,13 +189,5 @@ def view_record_for_full_avail_li_two(document) data: { record_id: document['id'] } ) end - - def additional_holdings_span - content_tag( - :span, - "View record for information on additional holdings", - "style": "font-size: small; font-style: italic;" - ) - end end # rubocop:enable Metrics/ModuleLength diff --git a/spec/helpers/holding_block_spec.rb b/spec/helpers/holding_block_spec.rb index 8840975b0..317b712f6 100644 --- a/spec/helpers/holding_block_spec.rb +++ b/spec/helpers/holding_block_spec.rb @@ -170,13 +170,13 @@ before { stub_holding_locations } it 'displays View Record for Availability' do - expect(search_result).to include 'View record for information on additional holdings' + expect(search_result).to include 'View Record for Full Availability' end end context '#holding_block_search' do before { stub_holding_locations } let(:expected_result) do - "" + "" end it 'matches the expected result' do expect(search_result).to eq(expected_result) @@ -293,15 +293,7 @@ before { stub_holding_locations } let(:expected_result) do <<~END_RESULT.strip - + END_RESULT end it 'matches the expected result' do @@ -400,7 +392,7 @@ context 'using the stackmap' do let(:expected_result) do - "" + "" end it 'matches the expected result' do expect(search_result).to eq(expected_result) @@ -492,7 +484,7 @@ context '#holding_block_search with embargoed thesis' do before { stub_holding_locations } let(:expected_result) do - "" + "" end it 'matches the expected result' do expect(search_result).to eq(expected_result) diff --git a/spec/requests/request_spec.rb b/spec/requests/request_spec.rb index 161b352b6..f5b458f0e 100644 --- a/spec/requests/request_spec.rb +++ b/spec/requests/request_spec.rb @@ -50,7 +50,7 @@ r = JSON.parse(response.body) expect(r['location'].length).to be > 2 get '/catalog?&search_field=all_fields&q=998574693506421' - expect(response.body).to include 'View record for information on additional holdings' + expect(response.body).to include 'View Record for Full Availability' end it 'displays the location name for an item with a single location' do get '/catalog/993213506421/raw'