Skip to content

Commit

Permalink
[#4153] Use COinS to provide Zotero integration on search results pag…
Browse files Browse the repository at this point in the history
…e, rather than UnAPI

The Zotero documentation (https://www.zotero.org/support/dev/exposing_metadata#using_an_open_standard_for_exposing_metadata)
lists three ways to expose metadata to zotero:
* <meta> tags (this doesn't work for a search results page, since it can only describe a single resource)
* COinS
* unAPI

Previously, we used unAPI on both the search results and show pages, and additionally
provided COinS on the show page.  However, the blacklight-unapi gem has not been
updated in 10 years and is not compatible with Rails 7.

This commit:
* removes unAPI from both search results and show pages
* adds COinS to the search results page
  • Loading branch information
sandbergja committed Aug 29, 2024
1 parent b660c06 commit edb6565
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 79 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ gem 'blacklight_dynamic_sitemap'
gem 'blacklight-marc', '~>8.1'
# slider limit support
gem 'blacklight_range_limit', '~> 8.2'
gem 'blacklight_unapi', git: 'https://github.com/pulibrary/blacklight_unapi.git', branch: 'main'
gem 'bootstrap', '~> 4.6'
# Capistrano
# In the Capistrano documentation, it has these limited to the development group, and `require: false``
Expand Down
10 changes: 0 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
GIT
remote: https://github.com/pulibrary/blacklight_unapi.git
revision: 79ac4bf1914f2b48ff7eae9fb79842e2c9cfff06
branch: main
specs:
blacklight_unapi (0.1.0)
blacklight (~> 7.0)
rails

GIT
remote: https://github.com/pulibrary/stringex.git
revision: 357f70511532a35b11a240e5ae06d02725cb8d0a
Expand Down Expand Up @@ -686,7 +677,6 @@ DEPENDENCIES
blacklight_advanced_search (~> 7.0)
blacklight_dynamic_sitemap
blacklight_range_limit (~> 8.2)
blacklight_unapi!
bootstrap (~> 4.6)
capistrano (~> 3.4)
capistrano-passenger
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
class CatalogController < ApplicationController
include BlacklightAdvancedSearch::Controller
include Blacklight::Catalog
include BlacklightUnapi::ControllerExtension

include Blacklight::Marc::Catalog
include BlacklightRangeLimit::ControllerOverride
Expand Down Expand Up @@ -676,9 +675,6 @@ class CatalogController < ApplicationController

config.add_results_document_tool(:bookmark, partial: 'bookmark_control')

config.unapi = {
'ris' => { content_type: 'application/x-research-info-systems' }
}
config.filter_search_state_fields = true
config.search_state_fields = config.search_state_fields + [
:advanced_type, :f1, :f2, :f3,
Expand Down
2 changes: 1 addition & 1 deletion app/views/catalog/_index_default.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% doc_presenter = document_presenter(document) %>
<%# default partial to display solr document fields in catalog index view -%>
<abbr class="unapi-id" title="<%= document.id %>" aria-hidden="true"></abbr>
<span class="Z3988" aria-hidden='true' title="<%= document.export_as_openurl_ctx_kev %>"></span>
<ul class="document-metadata dl-horizontal dl-invert">
<%= render IndexMetadataComponent.new presenter: doc_presenter %>
<li class="blacklight-holdings"><%= holding_block_search(document) %></li>
Expand Down
1 change: 0 additions & 1 deletion app/views/catalog/_show_header_default.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
<% if titlevalue = @document['title_vern_display'] %>
<h1 dir="<%= titlevalue.dir %>" lang="<%= language_iana %>"> <%= titlevalue %> </h1>
<% end %>
<abbr class="unapi-id" title="<%= @document.id %>" aria-hidden="true"></abbr>
<%= render_document_heading(@document, :tag => :h1) %>
</div>
1 change: 0 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<%= javascript_include_tag "https://www.google.com/books/jsapi.js", defer: true %>
<%= csrf_meta_tags %>
<%= content_for(:head) %>
<link rel="unapi-server" type="application/xml" title="unAPI" href="/unapi"/>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
Expand Down
1 change: 0 additions & 1 deletion public/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Disallow: /cgi-bin
Disallow: /account
Disallow: /borrow-direct
Disallow: /thumbnail
Disallow: /unapi
Disallow: /404
Disallow: /422
Disallow: /500
Expand Down
59 changes: 0 additions & 59 deletions spec/features/unapi_spec.rb

This file was deleted.

5 changes: 5 additions & 0 deletions spec/features/zotero_support_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
stub_holding_locations
end

it 'is available on the search results page' do
visit '/catalog?search_field=all_fields&q=history'
expect(page.all('.Z3988').length).to eq 20
end

it 'is available on the individual record page' do
visit '/catalog/9990315453506421'
expect(page.all('.Z3988').length).to eq 1
Expand Down
2 changes: 1 addition & 1 deletion spec/views/catalog/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
vernacular_title = find(:xpath, "//*[@id='content']/div[1]/h1[1]")
expect(vernacular_title['lang']).to eq 'ru'

header_title = find(:css, "#content > div.col-12.header-row > h1:nth-child(3)")
header_title = find(:css, "#content > div.col-12.header-row > h1:nth-child(2)")
expect(header_title['lang']).to eq 'ru'
end
end
Expand Down

0 comments on commit edb6565

Please sign in to comment.