diff --git a/.rubocop.yml b/.rubocop.yml index 710d9aa6f..dd478f06d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -84,7 +84,6 @@ Metrics/LineLength: - 'spec/features/searching_spec.rb' - 'spec/models/solr_document_spec.rb' - 'spec/controllers/bookmarks_controller_spec.rb' - - 'spec/views/catalog/umlaut_services_spec.rb' - 'spec/features/availability_spec.rb' - 'spec/helpers/holding_block_spec.rb' - 'spec/helpers/blacklight_helper_spec.rb' diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e5319272d..ba7da0894 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -9,26 +9,6 @@ def rails_env? Rails.env.production? end - # Generate the markup for the
containing a link to the umlaut service endpoint for a given record - # @param document [SolrDocument] the Solr Document for the record - # @return [String] the markup - def umlaut_services_fulltext(document) - services = '' - unless document.key? 'electronic_access_1display' - services << content_tag(:div, '', :id => 'full_text', :class => ['availability--online', 'availability_full-text', 'availability--panel_umlaut'], 'data-umlaut-full-text' => true) - end - services.html_safe - end - - # Generate the markup for two
elements containing links to umlaut services - # @return [String] the markup - def umlaut_services - services = '' - services << content_tag(:div, '', :id => 'excerpts', :class => ['availability--excerpts', 'availability_excerpts', 'availability--panel_umlaut'], 'data-umlaut-services' => true) - services << content_tag(:div, '', :id => 'highlighted_link', :class => ['availability--highlighted', 'availability_highlighted-link', 'availability--panel_umlaut'], 'data-umlaut-services' => true) - services.html_safe - end - # Generate an Array of
elements wrapping links to proxied service endpoints for access # Takes first 2 links for pairing with online holdings in search results # @param electronic_access [Hash] electronic resource information diff --git a/app/models/concerns/blacklight/solr/document/marc.rb b/app/models/concerns/blacklight/solr/document/marc.rb index ea3cf32bf..61fa3e77c 100644 --- a/app/models/concerns/blacklight/solr/document/marc.rb +++ b/app/models/concerns/blacklight/solr/document/marc.rb @@ -104,18 +104,6 @@ def alma_record? end end - def umlaut_fulltext_eligible? - if (umlaut_full_text_formats & fetch('format', []).map(&:downcase)).empty? - false - else - true - end - end - - def umlaut_full_text_formats - %w[book journal] - end - # does we have any standard numbers that can be used by other services def standard_numbers? std_numbers.any? { |v| key? v } diff --git a/app/services/holding_requests_adapter.rb b/app/services/holding_requests_adapter.rb index 9c6a4b77a..81a34283f 100644 --- a/app/services/holding_requests_adapter.rb +++ b/app/services/holding_requests_adapter.rb @@ -51,12 +51,6 @@ def getit_accessible? doc_electronic_access.keys.any? { |link| /getit\.princeton\.edu/.match(link) } end - # Determine whether or not the electronic resources are accessible using umlaut - # @return [TrueClass, FalseClass] - def umlaut_accessible? - getit_accessible? || doc_electronic_access.empty? || !@document.umlaut_fulltext_eligible? - end - # Retrieve only the ELF holding records # @return [Hash] ELF holding information def doc_holdings_elf diff --git a/app/services/online_holdings_markup_builder.rb b/app/services/online_holdings_markup_builder.rb index 27e414f2e..76a4488c7 100644 --- a/app/services/online_holdings_markup_builder.rb +++ b/app/services/online_holdings_markup_builder.rb @@ -84,15 +84,6 @@ def self.urlify(adapter) markup << content_tag(:li, link.html_safe, class: 'electronic-access') end - unless adapter.umlaut_accessible? - markup << content_tag(:li, '', - id: 'full_text', - class: ['availability--panel', - 'availability_full-text', - 'availability_full-text-alternative'], - 'data-umlaut-services' => true) - end - return content_tag(:ul, markup.html_safe) if electronic_access.count > 1 markup end diff --git a/app/views/catalog/_show_availability.html.erb b/app/views/catalog/_show_availability.html.erb index 66b285a5d..3ad126500 100644 --- a/app/views/catalog/_show_availability.html.erb +++ b/app/views/catalog/_show_availability.html.erb @@ -5,11 +5,7 @@

<%= t('blacklight.holdings.online') %>

<%= online if online.present? %>
-<% end %> - -<% if online.blank? && document.standard_numbers? && document.umlaut_fulltext_eligible? %> - <%= umlaut_services_fulltext(document) %> -<% end %> +<% end %> <% unless physical.empty? %>
diff --git a/app/views/catalog/_show_other_versions.html.erb b/app/views/catalog/_show_other_versions.html.erb index eb8b71d38..157dc6930 100644 --- a/app/views/catalog/_show_other_versions.html.erb +++ b/app/views/catalog/_show_other_versions.html.erb @@ -5,8 +5,4 @@

<%= t('blacklight.holdings.linked') %>

<%= render 'show_linked_records', linked_records: document_linked_records %>
-<% end %> - -<% if document.standard_numbers? %> - <%= umlaut_services %> -<% end %> +<% end %> \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9f9e6a235..ce96fb4ef 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -28,7 +28,6 @@ <% unless controller.controller_name == "catalog" && controller.action_name == "show" && @document.alma_record? %> <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML", async: true %> <% end %> - <%= javascript_include_tag "#{Requests.config['umlaut_base']}/assets/umlaut/update_html.js" %> <%= javascript_include_tag "https://www.google.com/books/jsapi.js" %> <%= csrf_meta_tags %> <%= content_for(:head) %> diff --git a/config/requests.yml b/config/requests.yml index ca4c5d4b7..af61ed7b0 100644 --- a/config/requests.yml +++ b/config/requests.yml @@ -1,7 +1,6 @@ # requests.yml defaults: &defaults - umlaut_base: https://getit.princeton.edu bibdata_base: <%= ENV['BIBDATA_BASE'] || "https://bibdata.princeton.edu" %> proxy_base: https://library.princeton.edu/resolve/lookup?url= voyager_api_base: https://webvoyage.princeton.edu:7014 diff --git a/spec/helpers/holding_block_spec.rb b/spec/helpers/holding_block_spec.rb index ee752a22c..83c62c112 100644 --- a/spec/helpers/holding_block_spec.rb +++ b/spec/helpers/holding_block_spec.rb @@ -18,9 +18,6 @@ let(:show_result_thesis_no_request) { helper.holding_request_block(SolrDocument.new(document_thesis_no_request_access)) } let(:show_result_thesis_embargoed) { helper.holding_request_block(SolrDocument.new(document_thesis_embargoed)) } - let(:show_result_umlaut_w_full_text) { helper.umlaut_services } - let(:not_umlaut_full_text_eligible) { SolrDocument.new(document_no_umlaut) } - let(:umlaut_full_text_eligible) { SolrDocument.new(document) } let(:holding_block_json) do { holding_id => { @@ -84,13 +81,6 @@ holdings_1display: holding_block_json }.with_indifferent_access end - let(:document_no_umlaut) do - { - id: '5', - format: ['Video'], - holdings_1display: holding_block_json - }.with_indifferent_access - end let(:document_no_holdings) do { id: '2' @@ -345,15 +335,6 @@ end end - context '#umlaut_format_eligible? formats' do - it 'is false when it is not umlaut format' do - expect(not_umlaut_full_text_eligible.umlaut_fulltext_eligible?).to be false - end - it 'is true when it is an umlaut format' do - expect(umlaut_full_text_eligible.umlaut_fulltext_eligible?).to be true - end - end - context '#holding_block record show - physical holdings' do let(:search_result) { helper.holding_block_search(document) } let(:call_number) { 'CD- 2018-11-11' } diff --git a/spec/services/online_holdings_markup_builder_spec.rb b/spec/services/online_holdings_markup_builder_spec.rb index 102e10a31..e2447bebf 100644 --- a/spec/services/online_holdings_markup_builder_spec.rb +++ b/spec/services/online_holdings_markup_builder_spec.rb @@ -46,7 +46,6 @@ allow(adapter).to receive(:doc_id).and_return('123456') allow(adapter).to receive(:voyager_holding?).and_return(true) allow(adapter).to receive(:doc_electronic_access).and_return('http://gateway.proquest.com/url': ['gateway.proquest.com'], 'http://arks.princeton.edu/ark:/88435/dsp0141687h654': ['DataSpace', 'Citation only']) - allow(adapter).to receive(:umlaut_accessible?).and_return(true) end describe '.electronic_access_link' do @@ -102,10 +101,6 @@ allow(adapter).to receive(:doc_electronic_access).and_return(marcit_url => ['getit.princeton.edu', 'View Princeton online holdings']) end - it 'is marked as full text record' do - expect(urlified_markup).to include 'data-umlaut-full-text="true"' - end - it 'has a marcit context object' do expect(urlified_markup).to include 'data-url-marcit' end diff --git a/spec/services/physical_holdings_markup_builder_spec.rb b/spec/services/physical_holdings_markup_builder_spec.rb index 058ca580a..951b0c485 100644 --- a/spec/services/physical_holdings_markup_builder_spec.rb +++ b/spec/services/physical_holdings_markup_builder_spec.rb @@ -54,7 +54,6 @@ allow(adapter).to receive(:doc_id).and_return('123456') allow(adapter).to receive(:voyager_holding?).and_return(true) allow(adapter).to receive(:doc_electronic_access).and_return('http://arks.princeton.edu/ark:/88435/dsp0141687h654': ['DataSpace', 'Citation only']) - allow(adapter).to receive(:umlaut_accessible?).and_return(true) allow(adapter).to receive(:unavailable_holding?).and_return(false) end diff --git a/spec/views/catalog/umlaut_services_spec.rb b/spec/views/catalog/umlaut_services_spec.rb deleted file mode 100644 index 9af1cfa60..000000000 --- a/spec/views/catalog/umlaut_services_spec.rb +++ /dev/null @@ -1,190 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe 'umlaut_services spec' do - let(:blacklight_config) do - CatalogController.new.blacklight_config - end - - before do - stub_holding_locations - allow(view).to receive(:blacklight_config).and_return(blacklight_config) - end - - describe '#umlaut_services for a record with a marcit online option' do - let(:document) { SolrDocument.new(properties) } - let(:properties) do - { - 'id' => '1', - 'lccn_s' => ['2001522653'], - 'isbn_s' => ['9781400827824'], - 'oclc_s' => %w[19590730 301985443], - 'format' => ['Journal'], - 'location_code_s' => ['sa'], - 'electronic_access_1display' => "{\"https://getit.princeton.edu/resolve?url_ver=Z39.88-2004&ctx_ver=Z39.88-2004&ctx_enc=info:ofi/enc:UTF-8&rfr_id=info:sid/sfxit.com:opac_856&url_ctx_fmt=info:ofi/fmt:kev:mtx:ctx&sfx.ignore_date_threshold=1&rft.object_id=954925427238&svc_val_fmt=info:ofi/fmt:kev:mtx:sch_svc&\":[\"getit.princeton.edu\",\"View Princeton's online holdings\"]}", - 'holdings_1display' => '{"9592399":{"location":"Online - *ONLINE*","library":"Online","location_code":"elf1","call_number":"Electronic Resource","call_number_browse":"Electronic Resource"}}' - } - end - - it 'has all umlaut additional services' do - render partial: 'catalog/show_other_versions', locals: { document: document } - expect(rendered).to have_selector '#highlighted_link' - expect(rendered).to have_selector '#excerpts' - end - - it 'has full-text service' do - render partial: 'catalog/show_availability', locals: { document: document } - expect(rendered).to have_selector '#full_text' - end - end - - context '#umlaut_services for a record with a non-marcit online option' do - let(:document) { SolrDocument.new(properties) } - let(:properties) do - { - 'id' => '2', - 'lccn_s' => ['2001522653'], - 'isbn_s' => ['9781400827824'], - 'oclc_s' => %w[19590730 301985443], - 'format' => ['Book'], - 'location_code_s' => ['sa'], - 'electronic_access_1display' => "{\"https://ebrary.com/121331313\":[\"ebrary.com\",\"View Princeton's online holdings\"]}", - 'holdings_1display' => '{"9592399":{"location":"Online - *ONLINE*","library":"Online","location_code":"elf1","call_number":"Electronic Resource","call_number_browse":"Electronic Resource"}}' - } - end - - it 'has all additional umlaut services' do - render partial: 'catalog/show_other_versions', locals: { document: document } - expect(rendered).to have_selector '#highlighted_link' - expect(rendered).to have_selector '#excerpts' - end - - it 'has full-text service' do - render partial: 'catalog/show_availability', locals: { document: document } - expect(rendered).to have_selector '#full_text' - end - end - - context '#umlaut_services for a record without an existing online option' do - let(:document) { SolrDocument.new(properties) } - let(:properties) do - { - 'id' => '3', - 'lccn_s' => ['2001522653'], - 'isbn_s' => ['9781400827824'], - 'oclc_s' => %w[19590730 301985443], - 'format' => ['Book'], - 'location_code_s' => ['sa'], - 'holdings_1display' => '{"13395":{"location":"Forrestal Annex - Temporary","library":"Forrestal Annex","location_code":"anxafst","copy_number":"1","call_number":"PS3563.A3294 xT3","call_number_browse":"PS3563.A3294 xT3"}}' - } - end - - it 'has all possible umlaut additional services included' do - render partial: 'catalog/show_other_versions', locals: { document: document } - expect(rendered).to have_selector '#highlighted_link' - expect(rendered).to have_selector '#excerpts' - end - - it 'has full-text service' do - render partial: 'catalog/show_availability', locals: { document: document } - expect(rendered).to have_selector '#full_text' - end - end - - context '#umlaut_services for a record without any standard numbers or eligible full-text formats' do - let(:document) { SolrDocument.new(properties) } - let(:properties) do - { - 'id' => '5', - 'format' => ['Book'], - 'location_code_s' => ['sa'], - 'holdings_1display' => '{"13395":{"location":"Forrestal Annex - Temporary","library":"Forrestal Annex","location_code":"anxafst","copy_number":"1","call_number":"PS3563.A3294 xT3","call_number_browse":"PS3563.A3294 xT3"}}' - } - end - - it 'has no umlaut additional services included' do - render partial: 'catalog/show_other_versions', locals: { document: document } - expect(rendered).not_to have_selector '#highlighted_link' - expect(rendered).not_to have_selector '#excerpts' - end - - it 'does not have full-text service' do - render partial: 'catalog/show_availability', locals: { document: document } - expect(rendered).not_to have_selector '#full_text' - end - end - - context 'has standard numbers and an ineligible full-text formats' do - let(:document) { SolrDocument.new(properties) } - let(:properties) do - { - 'id' => '5', - 'format' => ['Audio'], - 'oclc_s' => %w[19590730 301985443], - 'location_code_s' => ['sa'], - 'holdings_1display' => '{"13395":{"location":"Forrestal Annex - Temporary","library":"Forrestal Annex","location_code":"anxafst","copy_number":"1","call_number":"PS3563.A3294 xT3","call_number_browse":"PS3563.A3294 xT3"}}' - } - end - - it 'has highlighted links and excerpt umlaut blocks' do - render partial: 'catalog/show_other_versions', locals: { document: document } - expect(rendered).to have_selector '#highlighted_link' - expect(rendered).to have_selector '#excerpts' - end - - it 'does not have a full-text service' do - render partial: 'catalog/show_availability', locals: { document: document } - expect(rendered).not_to have_selector '#full_text' - end - end - - context 'full-text eligible formats and standard numbers' do - let(:document) { SolrDocument.new(properties) } - let(:properties) do - { - 'id' => '5', - 'format' => %w[Manuscript Book], - 'oclc_s' => %w[19590730], - 'location_code_s' => ['sa'], - 'holdings_1display' => '{"13395":{"location":"Forrestal Annex - Temporary","library":"Forrestal Annex","location_code":"anxafst","copy_number":"1","call_number":"PS3563.A3294 xT3","call_number_browse":"PS3563.A3294 xT3"}}' - } - end - - it 'has highlighted links and excerpt umlaut blocks' do - render partial: 'catalog/show_other_versions', locals: { document: document } - expect(rendered).to have_selector '#highlighted_link' - expect(rendered).to have_selector '#excerpts' - end - - it 'has full-text service' do - render partial: 'catalog/show_availability', locals: { document: document } - expect(rendered).to have_selector '#full_text' - end - end - - context '#umlaut_services for a record with a non-marcit online option and ineligible formats' do - let(:document) { SolrDocument.new(properties) } - let(:properties) do - { - 'id' => '2', - 'oclc_s' => %w[19590730 301985443], - 'format' => ['Audio'], - 'location_code_s' => ['sa'], - 'electronic_access_1display' => "{\"https://ebrary.com/121331313\":[\"ebrary.com\",\"View Princeton's online holdings\"]}", - 'holdings_1display' => '{"9592399":{"location":"Online - *ONLINE*","library":"Online","location_code":"elf1","call_number":"Electronic Resource","call_number_browse":"Electronic Resource"}}' - } - end - - it 'has all umlaut highlighted link and excerpt services' do - render partial: 'catalog/show_other_versions', locals: { document: document } - expect(rendered).to have_selector '#highlighted_link' - expect(rendered).to have_selector '#excerpts' - end - - it 'does not have umlaut full-text options' do - render partial: 'catalog/show_availability', locals: { document: document } - expect(rendered).not_to have_selector '#full_text' - end - end -end