Skip to content

Commit

Permalink
[#4356] Remove cdl references
Browse files Browse the repository at this point in the history
Co-authored-by: Christina Chortaria <[email protected]>
  • Loading branch information
vh8154 and christinach committed Jan 2, 2025
1 parent 2ee939c commit 67fdad5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 277 deletions.
10 changes: 0 additions & 10 deletions app/helpers/holdings_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def holding_block_search(document)

holdings_hash.first(2).each do |id, holding|
block << first_two_holdings_block(document, id, holding)
block << content_tag(:li, cdl_placeholder)
end

block << controller.view_context.render(Holdings::OnlineHoldingsComponent.new(document:))
Expand Down Expand Up @@ -157,15 +156,6 @@ def holding_status_li(accumulator, document, check_availability, id, holding)
)
end

def cdl_placeholder
content_tag(
:span,
'',
class: 'badge bg-primary',
data: { 'availability-cdl': true }
)
end

def view_record_for_full_avail_li(document)
content_tag(
:li,
Expand Down
61 changes: 6 additions & 55 deletions app/javascript/orangelight/availability.es6
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,7 @@ export default class AvailabilityUpdater {
const availability_element = $(
`*[data-availability-record='true'][data-record-id='${record_id}'][data-holding-id='${holding_id}'] .availability-icon`
);
this.apply_availability_label(
availability_element,
availability_info,
true
);
this.apply_availability_label(availability_element, availability_info);
}

// Bib data does not know about bound-with records and therefore we don't get availability
Expand Down Expand Up @@ -219,7 +215,7 @@ export default class AvailabilityUpdater {
const result = [];
for (const holding_id in holding_records[id]) {
const availability_info = holding_records[id][holding_id];
const { label, cdl } = holding_records[id][holding_id];
const { label } = holding_records[id][holding_id];
// case :constituent with host ids.
// data-record-id has a different this.id when there are host ids.
let availability_element;
Expand All @@ -240,14 +236,7 @@ export default class AvailabilityUpdater {
);
holding_location.text(label);
}
this.apply_availability_label(
availability_element,
availability_info,
false
);
if (cdl) {
insert_online_link();
}
this.apply_availability_label(availability_element, availability_info);
result.push(this.update_request_button(holding_id, availability_info));
}
return result;
Expand Down Expand Up @@ -365,17 +354,6 @@ export default class AvailabilityUpdater {
});
}

update_request_button(holding_id, availability_info) {
const { cdl } = availability_info;
const location_services_element = $(
`.location-services[data-holding-id='${holding_id}'] a`
);
// if it's on CDL then it can't be requested
if (cdl) {
location_services_element.remove();
}
}

apply_scsb_record(barcode, item_data) {
const availability_element = $(
`*[data-scsb-availability='true'][data-scsb-barcode='${barcode}']`
Expand All @@ -392,13 +370,9 @@ export default class AvailabilityUpdater {
return true;
}

apply_availability_label(
availability_element,
availability_info,
addCdlBadge
) {
apply_availability_label(availability_element, availability_info) {
availability_element.addClass('badge');
const { status_label, cdl, location, id } = availability_info;
const { status_label, location, id } = availability_info;
const specialStatusLocations = [
'marquand$stacks',
'marquand$pj',
Expand All @@ -409,30 +383,7 @@ export default class AvailabilityUpdater {
];
availability_element.text(status_label);
if (status_label.toLowerCase() === 'unavailable') {
// The physical copy is not available but we highlight that the online copy is.
if (cdl) {
if (addCdlBadge) {
// Add an Online badge, next to Unavailable.
// (used in the Search Results page)
availability_element.addClass('bg-danger');

const cdlPlaceholder = availability_element
.parent()
.next()
.find("*[data-availability-cdl='true']");
cdlPlaceholder.text('Online');
cdlPlaceholder.addClass('badge bg-primary');
} else {
// Display Online, instead of Unavailable, and remove the request button.
// (used in the Show page)
availability_element.text('Online');
availability_element.addClass('bg-secondary');
const location_services_element = $(
`.location-services[data-holding-id='${id}'] a`
);
location_services_element.remove();
}
} else if (specialStatusLocations.includes(location)) {
if (specialStatusLocations.includes(location)) {
this.checkSpecialLocation(location, availability_element);
} else {
availability_element.addClass('bg-danger');
Expand Down
4 changes: 0 additions & 4 deletions docs/orangelight-figgy.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,3 @@ Orangelight uses the bibid from the data attribute and invokes an async graphql
* In the electronic_access_1_display we build the catalog domain urls by using the figgy_ark_cache. This is happening during indexing.

_Notes_: The rake task to update the figgy_ark_cache errors. The figgy_ark_cache has not been updated since voyager and still includes voyager ids. As a result the catalog domain urls that are structured and indexed during indexing time in the 'electronic_access_1display' have the voyager id. The user clicks on the Digital Content and a new record page will open because it tries to resolve the voyager id to an alma id.

### CDL item viewer
* Similar to step 1, if there is a scanned resource in Figgy, Orangelight returns the viewer. CDL items are accessible only through CAS and for specific patron groups; this is handled in Figgy. [Figgy's eligible item service](https://github.com/pulibrary/figgy/blob/main/app/services/cdl/eligible_item_service.rb#L4) will do a check to see if the specific item is on cdl. If the item is on cdl it will allow the user to charge or hold it.

21 changes: 0 additions & 21 deletions spec/features/availability_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,6 @@
end
end

# This test is quite brittle and will break once this item is removed from
# CDL. It seems valid to remove it if it hasn't been refactored by then, and
# at least create an issue to replace it with a jest test during a refactor of
# this javascript.

# this item is no longer on CDL
xdescribe 'An item reserved for controlled digital lending', js: true do
before do
stub_holding_locations
visit '/catalog/9976990033506421'
end

it 'adds a link to the digital object', unless: in_ci? do
expect(page).to have_selector('.availability--online a', count: 1)
expect(page).to have_selector('h3', text: "Available Online")
expect(page).to have_selector('li', text: "Princeton users: View digital content")
expect(page).to have_selector('.holding-status', text: "Reserved for digital lending", exact_text: true)
expect(page).not_to have_selector('a.request')
end
end

# This item is no longer in a temp location
xdescribe 'Physical Holdings in temp locations', js: true do
it 'displays temp location on search results along with call number', unless: in_ci? do
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/bibdata/availability.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"9946093213506421":{"22258298950006421":{"on_reserve":"N","location":"rare$whs","label":"Special Collections - William H. Scheide Library","status_label":"Available","copy_number":null,"cdl":false,"temp_location":false,"id":"22258298950006421"},"22258298920006421":{"on_reserve":"N","location":"rare$whs","label":"Special Collections - William H. Scheide Library","status_label":"Available","copy_number":null,"cdl":false,"temp_location":false,"id":"22258298920006421"}}}
{"9946093213506421":{"22258298950006421":{"on_reserve":"N","location":"rare$whs","label":"Special Collections - William H. Scheide Library","status_label":"Available","copy_number":null,"temp_location":false,"id":"22258298950006421"},"22258298920006421":{"on_reserve":"N","location":"rare$whs","label":"Special Collections - William H. Scheide Library","status_label":"Available","copy_number":null,"temp_location":false,"id":"22258298920006421"}}}
Loading

0 comments on commit 67fdad5

Please sign in to comment.