-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bound with redesign for child records
- Loading branch information
Showing
17 changed files
with
268 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 38 additions & 31 deletions
69
app/components/access_panels/location_item_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,42 @@ | ||
<%= tag.tr class: classes, data: { barcode: item.barcode } do %> | ||
<td class="callnumber"> | ||
<%= item.callnumber %> | ||
</td> | ||
<% if render_item_note? %> | ||
<td class="public-note"> | ||
<% if item.public_note.present? %> | ||
<div class='public-note note-highlight'>Note: <%= inject_line_break_opportunities item.public_note %></div> | ||
<% end %> | ||
</td> | ||
<% end %> | ||
<% if render_item_details? %> | ||
<td class="item-availability" data-update-status="<%= !has_in_process_availability_class? %>" data-live-lookup-id="<%= item.live_lookup_instance_id %>" data-status-target=".availability-icon" data-item-id="<%= item.live_lookup_item_id %>" <%= "data-request-url='#{helpers.request_url(document, library: item.library, location: item.effective_permanent_location_code, barcode: item.barcode)}'".html_safe if render_real_time_availability_request_link? %>> | ||
<span class="availability-icon-wrapper"> | ||
<i class="availability-icon <%= item.status.availability_class %>"></i> | ||
<span data-available-text="<%= t('searchworks.availability.available') %>" data-unavailable-text="<%= t('searchworks.availability.unavailable') %>" class='status-text'> | ||
<%= availability_text %> | ||
<%= tag.li class: classes, data: html_data do %> | ||
<div class="d-flex"> | ||
<div class="callnumber"> | ||
<%= item.callnumber %> | ||
</div> | ||
<% if render_item_details? %> | ||
<div class="item-availability" data-update-status="<%= !has_in_process_availability_class? %>" data-live-lookup-id="<%= item.live_lookup_instance_id %>" data-status-target=".availability-icon" data-item-id="<%= item.live_lookup_item_id %>" <%= "data-request-url='#{helpers.request_url(document, library: item.library, location: item.effective_permanent_location_code, barcode: item.barcode)}'".html_safe if render_real_time_availability_request_link? %>> | ||
<span class="availability-icon-wrapper"> | ||
<i class="availability-icon <%= item.status.availability_class %>"></i> | ||
<span data-available-text="<%= t('searchworks.availability.available') %>" data-unavailable-text="<%= t('searchworks.availability.unavailable') %>" class='status-text'> | ||
<%= availability_text %> | ||
</span> | ||
</span> | ||
</span> | ||
<span class="temporary-location"> | ||
<%= temporary_location_text %> | ||
</span> | ||
<% if item.on_reserve? %> | ||
<%= item.loan_period %> | ||
<% end %> | ||
<% if render_item_level_request_link? %> | ||
<span class="request-link"> | ||
<%= render item.request_link %> | ||
<span class="temporary-location"> | ||
<%= temporary_location_text %> | ||
</span> | ||
<% end %> | ||
</td> | ||
<% else %> | ||
<td></td> | ||
<% if item.on_reserve? %> | ||
<%= item.loan_period %> | ||
<% end %> | ||
<% if render_item_level_request_link? %> | ||
<span class="request-link"> | ||
<%= render item.request_link %> | ||
</span> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> | ||
|
||
<div class="public-note"> | ||
<% if item.public_note.present? %> | ||
<div class='public-note note-highlight'>Note: <%= inject_line_break_opportunities item.public_note %></div> | ||
<% end %> | ||
</div> | ||
|
||
<% if bound_with_parent? %> | ||
<div class="bound-with p-2 mt-2"> | ||
<div class="bound-with-type">Bound and shelved with</div> | ||
<div class="bound-with-title"><%= link_to bound_with_title, solr_document_path(item.bound_with_hrid) %></div> | ||
<div class="bound-with-callnumber"><%= bound_with_callnumber %></div> | ||
</div> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
app/components/search_result/location_item_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<%= tag.tr class: classes, data: { barcode: item.barcode } do %> | ||
<td class="callnumber"> | ||
<%= item.callnumber %> | ||
</td> | ||
|
||
<% if render_item_details? %> | ||
<td class="item-availability" data-update-status="<%= !has_in_process_availability_class? %>" data-live-lookup-id="<%= item.live_lookup_instance_id %>" data-status-target=".availability-icon" data-item-id="<%= item.live_lookup_item_id %>" <%= "data-request-url='#{helpers.request_url(document, library: item.library, location: item.effective_permanent_location_code, barcode: item.barcode)}'".html_safe if render_real_time_availability_request_link? %>> | ||
<span class="availability-icon-wrapper"> | ||
<i class="availability-icon <%= item.status.availability_class %>"></i> | ||
<span data-available-text="<%= t('searchworks.availability.available') %>" data-unavailable-text="<%= t('searchworks.availability.unavailable') %>" class='status-text'> | ||
<%= availability_text %> | ||
</span> | ||
</span> | ||
<span class="temporary-location"> | ||
<%= temporary_location_text %> | ||
</span> | ||
<% if item.on_reserve? %> | ||
<%= item.loan_period %> | ||
<% end %> | ||
<% if render_item_level_request_link? %> | ||
<span class="request-link"> | ||
<%= render item.request_link %> | ||
</span> | ||
<% end %> | ||
</td> | ||
<% else %> | ||
<td></td> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# frozen_string_literal: true | ||
|
||
module SearchResult | ||
class LocationItemComponent < ViewComponent::Base | ||
with_collection_parameter :item | ||
attr_reader :item, :document, :classes | ||
|
||
def initialize(item:, document:, classes: nil, render_item_level_request_link: true) | ||
super | ||
|
||
@item = item | ||
@classes = classes | ||
@document = document | ||
@render_item_level_request_link = render_item_level_request_link | ||
end | ||
|
||
def availability_text | ||
item.status.status_text unless temporary_location_text | ||
end | ||
|
||
def temporary_location_text | ||
return if item.effective_location&.details&.key?('availabilityClass') || | ||
item.effective_location&.details&.key?('searchworksTreatTemporaryLocationAsPermanentLocation') || | ||
item.effective_permanent_location_code == item.temporary_location_code | ||
|
||
item.temporary_location&.name | ||
end | ||
|
||
def has_in_process_availability_class? | ||
availability_class = item.effective_location&.details&.dig('availabilityClass') | ||
availability_class.present? && availability_class == 'In_process' | ||
end | ||
|
||
def render_item_details? | ||
!item.suppressed? | ||
end | ||
|
||
def render_item_level_request_link? | ||
@render_item_level_request_link | ||
end | ||
|
||
def render_real_time_availability_request_link? | ||
# we're not rendering item-level request links (because e.g. there's already alocation level request link) | ||
return false unless render_item_level_request_link? | ||
|
||
# don't render unless item is requestable | ||
return false unless item.requestable? | ||
|
||
# non-circulating items don't need real time availability | ||
return false unless item.circulates? | ||
|
||
# items that definitely have an item-level request link at render time don't need real time availability | ||
return false if item.request_link.render? | ||
|
||
true | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.