Skip to content

Commit

Permalink
Merge pull request #2118 from cul-it/DACCESS-311
Browse files Browse the repository at this point in the history
Daccess 311 - worldcat links
  • Loading branch information
jgreidy authored May 24, 2024
2 parents 7cb2750 + cc2c96c commit e5dd181
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 11 deletions.
5 changes: 5 additions & 0 deletions blacklight-cornell/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ GEM
libnotify (0.9.4)
ffi (>= 1.0.11)
library_stdnums (1.6.0)
libv8-node (16.10.0.0-aarch64-linux)
libv8-node (16.10.0.0-x86_64-darwin)
libv8-node (16.10.0.0-x86_64-linux)
listen (3.9.0)
Expand Down Expand Up @@ -549,6 +550,8 @@ GEM
net-ssh (5.2.0)
netrc (0.11.0)
nio4r (2.7.1)
nokogiri (1.16.4-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-linux)
Expand Down Expand Up @@ -756,6 +759,7 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.7.3-aarch64-linux)
sqlite3 (1.7.3-x86_64-darwin)
sqlite3 (1.7.3-x86_64-linux)
sshkit (1.22.2)
Expand Down Expand Up @@ -836,6 +840,7 @@ GEM
zeitwerk (2.6.13)

PLATFORMS
aarch64-linux
x86_64-darwin-23
x86_64-linux

Expand Down
2 changes: 1 addition & 1 deletion blacklight-cornell/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
get 'credits' => 'catalog#credits', :as => 'catalog_credits'

get '/number/:id', to: 'catalog#worldcat_number', as: 'number_search'
get '/oclc/:id', to: 'catalog#worldcat_number', as: 'oclc_search'
get '/oclc/:id', to: 'catalog#worldcat_oclc', as: 'oclc_search'
get '/isbnissn/:id', to: 'catalog#worldcat_isbnissn', as: 'isbnissn_search'

get '/browse/authors' => 'browse#authors', :as => 'browse_authors'
Expand Down
1 change: 1 addition & 0 deletions blacklight-cornell/features/browse/browse_info.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Feature: Browse info
@browse @javascript
Scenario: View an author title authority record for a work enhanced by Wikidata
Given I request the author title item view for Beethoven, Ludwig van, 1770-1827. | Septet, clarinet, bassoon, horn, violin, viola, cello, double bass, op. 20, E♭ major
And I sleep 1 second
Then I should see the text 'Works:'
And I should see the text 'Instrumentation:'
And I should see the text 'Opus:'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@

Then("Digital Collections should list {string}") do |string|
# don't require "Articles & Full Text" to be in second column
dc_bento = page.find("div#digitalCollections").first(:xpath,".//..")
within(dc_bento) do
expect(page.first("h3.bento_item_title", :text => string))
digcoll = page.find("#digcoll", visible: false, wait: 10)
webpane = digcoll.find("div.web-pane", visible: false, wait: 10)
within(webpane) do
expect(page.first("h3.bento_item_title", :text => string, visible: false, wait: 10))
end
end

Expand Down
29 changes: 22 additions & 7 deletions blacklight-cornell/lib/blacklight_cornell/cornell_catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,9 @@ def worldcat_number
@id = ActionController::Base.helpers.sanitize(params[:id])

redirect_to utf8: "✓",
q_row: ["#{@id}"],
op_row: ["AND"],
search_field_row: ["number"],
q_row: ["#{@id}", ""],
op_row: ["AND", "AND"],
search_field_row: ["number", "all_fields"],
sort: "score desc, pub_date_sort desc, title_sort asc",
search_field: "advanced",
advanced_query: "yes",
Expand All @@ -456,13 +456,13 @@ def worldcat_number
action: "index"
end

def worldcat_isbnissn
def worldcat_oclc
@id = ActionController::Base.helpers.sanitize(params[:id])

redirect_to utf8: "✓",
q_row: ["#{@id}"],
op_row: ["AND"],
search_field_row: ["isbnissn"],
q_row: ["OCoLC #{@id}", ""],
op_row: ["phrase", "AND"],
search_field_row: ["number", "all_fields"],
sort: "score desc, pub_date_sort desc, title_sort asc",
search_field: "advanced",
advanced_query: "yes",
Expand All @@ -471,6 +471,21 @@ def worldcat_isbnissn
action: "index"
end

def worldcat_isbnissn
@id = ActionController::Base.helpers.sanitize(params[:id])

redirect_to utf8: "✓",
q_row: ["#{@id}", ""],
op_row: ["AND", "AND"],
search_field_row: ["isbnissn", "all_fields"],
sort: "score desc, pub_date_sort desc, title_sort asc",
search_field: "advanced",
advanced_query: "yes",
commit: "Search",
controller: "catalog",
action: "index"
end

protected

# sets up the session[:history] hash if it doesn't already exist.
Expand Down
4 changes: 4 additions & 0 deletions blacklight-cornell/lib/blacklight_cornell/discogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def make_discogs_search_call(query_string)
result = JSON.parse(data)
return result if resp.kind_of? Net::HTTPSuccess
return [] if resp.kind_of? Net::HTTPError
rescue StandardError
return []
end

def make_discogs_show_call(id)
Expand All @@ -206,6 +208,8 @@ def make_discogs_show_call(id)
result = JSON.parse(data)
return result if resp.kind_of? Net::HTTPSuccess
return {} if resp.kind_of? Net::HTTPError
rescue StandardError
return {}
end

def deep_clone object
Expand Down

0 comments on commit e5dd181

Please sign in to comment.