From ede8f9351ae823fa260ed3d47c2e54decc2e8f08 Mon Sep 17 00:00:00 2001 From: Chris Clement Date: Fri, 11 Oct 2019 12:52:36 -0400 Subject: [PATCH 001/114] Bibs with a single holding and item descriptions automatically shows the items table --- app/assets/javascripts/availability.js.erb | 30 ++++++++++++--------- app/controllers/franklin_alma_controller.rb | 16 ++++++++--- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/availability.js.erb b/app/assets/javascripts/availability.js.erb index ca108d2d..e3cf8db1 100644 --- a/app/assets/javascripts/availability.js.erb +++ b/app/assets/javascripts/availability.js.erb @@ -143,17 +143,23 @@ $(document).ready(function() { } var dataLen = json.data.length; - if(dataLen == 0) { - //$('#table-wrapper-' + mmsid).hide(); - } - // Reference: https://stackoverflow.com/a/15458987 - // Check if the location of the first holding is an HTML element, - // indicating this is for a serial - else if(/<[a-z][\s\S]*>/i.test(json.data[0][2])) { - $('#requestOptionsAvailability-' + mmsid).text('Holdings'); + if(dataLen > 0) { + // Reference: https://stackoverflow.com/a/15458987 + // Check if the location of the first holding is an HTML element, + // indicating this is for a serial + if(/<[a-z][\s\S]*>/i.test(json.data[0][2])) { + $('#requestOptionsAvailability-' + mmsid).text('Holdings'); + } + else { + $('#requestOptionsAvailability-' + mmsid).text('Availability'); + } } - else { - $('#requestOptionsAvailability-' + mmsid).text('Availability'); + else if(dataLen === undefined && !Array.isArray(json.data)) { + // Single holding case + var show_location = true; + loadItems(json.data.mmsid, json.data.holding_id, json.data.location_code, show_location); + $('.backbutton-top-' + mmsid).hide(); + $('.backbutton-' + mmsid).hide(); } $('.load-holding-details').each(function(idx, element) { @@ -341,11 +347,11 @@ $(document).ready(function() { ba.loadRequestOptions(); }); -function loadItems(mms_id, holding_id, location_code) { +function loadItems(mms_id, holding_id, location_code, show_location = false) { renderdata[mms_id] = []; var holdingItemsTable = $('#holdingItems-' + mms_id).DataTable(); holdingItemsTable.clear().draw(); - holdingItemsTable.ajax.url('/alma/holding_items.json?mms_id=' + mms_id + "&holding_id=" + holding_id + "¤t_location=" + location_code).load(); + holdingItemsTable.ajax.url('/alma/holding_items.json?mms_id=' + mms_id + "&holding_id=" + holding_id + "¤t_location=" + location_code + "&show_location=" + show_location).load(); swapDataTables(mms_id); } diff --git a/app/controllers/franklin_alma_controller.rb b/app/controllers/franklin_alma_controller.rb index a915198b..440417e2 100644 --- a/app/controllers/franklin_alma_controller.rb +++ b/app/controllers/franklin_alma_controller.rb @@ -264,6 +264,11 @@ def single_availability end end + if bib_data['availability'][mmsid]['holdings'].length() == 1 && has_holding_info + holding = bib_data['availability'][mmsid]['holdings'].first + table_data = {"mmsid": mmsid, "holding_id": holding['holding_id'], "location_code": holding['location_code']} + end + metadata[mmsid][:inventory_type] = inventory_type render :json => {"metadata": metadata, "data": table_data} end @@ -297,6 +302,7 @@ def check_requestable(has_holding_info = false) def holding_items userid = session['id'].presence || nil due_date_policy = 'Please log in for loan and request information' if userid.nil? + show_location = params.delete("show_location") == "true" api_instance = BlacklightAlma::BibsApi.instance api = api_instance.ezwadl_api[0] options = {:expand => 'due_date_policy', :offset => 0, :limit => 100, :user_id => userid, :order_by => 'description'} @@ -309,14 +315,18 @@ def holding_items policies = {} pids_to_check = [] - table_data = response_data['item'].map { |item| data = item['item_data'] + + location = show_location ? + "#{item['item_data']['location']['desc']}
#{item['holding_data']['call_number']}
" : + "" + unless(policies.has_key?(data['policy']['value']) || data['base_status']['desc'] != "Item in place" || userid.nil?) policies[data['policy']['value']] = nil pids_to_check << [data['pid'], data['policy']['value']] end - [data['policy']['value'], data['pid'], data['description'], data['base_status']['desc'], data['barcode'], due_date_policy || data['due_date_policy'], [], params['mms_id'], params['holding_id']] + [data['policy']['value'], data['pid'], location + data['description'], data['base_status']['desc'], data['barcode'], due_date_policy || data['due_date_policy'], [], params['mms_id'], params['holding_id']] } while options[:offset] + options[:limit] < response_data['total_record_count'] @@ -329,7 +339,7 @@ def holding_items policies[data['policy']['value']] = nil pids_to_check << [data['pid'], data['policy']['value']] end - [data['policy']['value'], data['pid'], data['description'], due_date_policy || data['due_date_policy'], data['base_status']['desc'], data['barcode'], [], params['mms_id'], params['holding_id']] + [data['policy']['value'], data['pid'], location + data['description'], due_date_policy || data['due_date_policy'], data['base_status']['desc'], data['barcode'], [], params['mms_id'], params['holding_id']] } end From 7bb2350b09d056284164d213b6ba966d4e11717f Mon Sep 17 00:00:00 2001 From: Chris Clement Date: Fri, 11 Oct 2019 13:52:37 -0400 Subject: [PATCH 002/114] Fixed HTML --- app/controllers/franklin_alma_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/franklin_alma_controller.rb b/app/controllers/franklin_alma_controller.rb index 440417e2..0b193a93 100644 --- a/app/controllers/franklin_alma_controller.rb +++ b/app/controllers/franklin_alma_controller.rb @@ -319,7 +319,7 @@ def holding_items data = item['item_data'] location = show_location ? - "#{item['item_data']['location']['desc']}
#{item['holding_data']['call_number']}
" : + "#{item['item_data']['location']['desc']}
#{item['holding_data']['call_number']}
" : "" unless(policies.has_key?(data['policy']['value']) || data['base_status']['desc'] != "Item in place" || userid.nil?) From 2ea432e53dc54cdbece9a1cb8ff7ed09c92c1632 Mon Sep 17 00:00:00 2001 From: Chris Clement Date: Fri, 11 Oct 2019 14:22:12 -0400 Subject: [PATCH 003/114] Fix to account for asset precompilation --- app/assets/javascripts/availability.js.erb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/availability.js.erb b/app/assets/javascripts/availability.js.erb index e3cf8db1..128fb59f 100644 --- a/app/assets/javascripts/availability.js.erb +++ b/app/assets/javascripts/availability.js.erb @@ -347,8 +347,13 @@ $(document).ready(function() { ba.loadRequestOptions(); }); -function loadItems(mms_id, holding_id, location_code, show_location = false) { +function loadItems(mms_id, holding_id, location_code, show_location) { renderdata[mms_id] = []; + + // Reference: https://stackoverflow.com/a/35464024 + // This is needed so that asset precompilation doesn't fail + show_location = typeof show_location !== 'undefined' ? show_location : false; + var holdingItemsTable = $('#holdingItems-' + mms_id).DataTable(); holdingItemsTable.clear().draw(); holdingItemsTable.ajax.url('/alma/holding_items.json?mms_id=' + mms_id + "&holding_id=" + holding_id + "¤t_location=" + location_code + "&show_location=" + show_location).load(); From 589475e15ca01a268ae51cdb83a12d137f5c8a78 Mon Sep 17 00:00:00 2001 From: Chris Clement Date: Wed, 30 Oct 2019 14:19:20 -0400 Subject: [PATCH 004/114] Revert "Merge pull request #18 from upenn-libraries/single_holding_fix" This reverts commit d8655d51a37daea8ad8153ff1b3776564d54acb7, reversing changes made to e0d7298825b241ce691239be0291341269d576f2. --- app/assets/javascripts/availability.js.erb | 35 +++++++-------------- app/controllers/franklin_alma_controller.rb | 16 ++-------- 2 files changed, 15 insertions(+), 36 deletions(-) diff --git a/app/assets/javascripts/availability.js.erb b/app/assets/javascripts/availability.js.erb index 128fb59f..ca108d2d 100644 --- a/app/assets/javascripts/availability.js.erb +++ b/app/assets/javascripts/availability.js.erb @@ -143,23 +143,17 @@ $(document).ready(function() { } var dataLen = json.data.length; - if(dataLen > 0) { - // Reference: https://stackoverflow.com/a/15458987 - // Check if the location of the first holding is an HTML element, - // indicating this is for a serial - if(/<[a-z][\s\S]*>/i.test(json.data[0][2])) { - $('#requestOptionsAvailability-' + mmsid).text('Holdings'); - } - else { - $('#requestOptionsAvailability-' + mmsid).text('Availability'); - } + if(dataLen == 0) { + //$('#table-wrapper-' + mmsid).hide(); + } + // Reference: https://stackoverflow.com/a/15458987 + // Check if the location of the first holding is an HTML element, + // indicating this is for a serial + else if(/<[a-z][\s\S]*>/i.test(json.data[0][2])) { + $('#requestOptionsAvailability-' + mmsid).text('Holdings'); } - else if(dataLen === undefined && !Array.isArray(json.data)) { - // Single holding case - var show_location = true; - loadItems(json.data.mmsid, json.data.holding_id, json.data.location_code, show_location); - $('.backbutton-top-' + mmsid).hide(); - $('.backbutton-' + mmsid).hide(); + else { + $('#requestOptionsAvailability-' + mmsid).text('Availability'); } $('.load-holding-details').each(function(idx, element) { @@ -347,16 +341,11 @@ $(document).ready(function() { ba.loadRequestOptions(); }); -function loadItems(mms_id, holding_id, location_code, show_location) { +function loadItems(mms_id, holding_id, location_code) { renderdata[mms_id] = []; - - // Reference: https://stackoverflow.com/a/35464024 - // This is needed so that asset precompilation doesn't fail - show_location = typeof show_location !== 'undefined' ? show_location : false; - var holdingItemsTable = $('#holdingItems-' + mms_id).DataTable(); holdingItemsTable.clear().draw(); - holdingItemsTable.ajax.url('/alma/holding_items.json?mms_id=' + mms_id + "&holding_id=" + holding_id + "¤t_location=" + location_code + "&show_location=" + show_location).load(); + holdingItemsTable.ajax.url('/alma/holding_items.json?mms_id=' + mms_id + "&holding_id=" + holding_id + "¤t_location=" + location_code).load(); swapDataTables(mms_id); } diff --git a/app/controllers/franklin_alma_controller.rb b/app/controllers/franklin_alma_controller.rb index 0b193a93..a915198b 100644 --- a/app/controllers/franklin_alma_controller.rb +++ b/app/controllers/franklin_alma_controller.rb @@ -264,11 +264,6 @@ def single_availability end end - if bib_data['availability'][mmsid]['holdings'].length() == 1 && has_holding_info - holding = bib_data['availability'][mmsid]['holdings'].first - table_data = {"mmsid": mmsid, "holding_id": holding['holding_id'], "location_code": holding['location_code']} - end - metadata[mmsid][:inventory_type] = inventory_type render :json => {"metadata": metadata, "data": table_data} end @@ -302,7 +297,6 @@ def check_requestable(has_holding_info = false) def holding_items userid = session['id'].presence || nil due_date_policy = 'Please log in for loan and request information' if userid.nil? - show_location = params.delete("show_location") == "true" api_instance = BlacklightAlma::BibsApi.instance api = api_instance.ezwadl_api[0] options = {:expand => 'due_date_policy', :offset => 0, :limit => 100, :user_id => userid, :order_by => 'description'} @@ -315,18 +309,14 @@ def holding_items policies = {} pids_to_check = [] + table_data = response_data['item'].map { |item| data = item['item_data'] - - location = show_location ? - "#{item['item_data']['location']['desc']}
#{item['holding_data']['call_number']}
" : - "" - unless(policies.has_key?(data['policy']['value']) || data['base_status']['desc'] != "Item in place" || userid.nil?) policies[data['policy']['value']] = nil pids_to_check << [data['pid'], data['policy']['value']] end - [data['policy']['value'], data['pid'], location + data['description'], data['base_status']['desc'], data['barcode'], due_date_policy || data['due_date_policy'], [], params['mms_id'], params['holding_id']] + [data['policy']['value'], data['pid'], data['description'], data['base_status']['desc'], data['barcode'], due_date_policy || data['due_date_policy'], [], params['mms_id'], params['holding_id']] } while options[:offset] + options[:limit] < response_data['total_record_count'] @@ -339,7 +329,7 @@ def holding_items policies[data['policy']['value']] = nil pids_to_check << [data['pid'], data['policy']['value']] end - [data['policy']['value'], data['pid'], location + data['description'], due_date_policy || data['due_date_policy'], data['base_status']['desc'], data['barcode'], [], params['mms_id'], params['holding_id']] + [data['policy']['value'], data['pid'], data['description'], due_date_policy || data['due_date_policy'], data['base_status']['desc'], data['barcode'], [], params['mms_id'], params['holding_id']] } end From a77d4bb9ed47e155e4d25422a8fcb4d25b1e244a Mon Sep 17 00:00:00 2001 From: Katherine Schultz Date: Wed, 30 Oct 2019 15:14:57 -0400 Subject: [PATCH 005/114] edit FEATURED loc to add Moelis Lounge --- config/translation_maps/locations.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/translation_maps/locations.xml b/config/translation_maps/locations.xml index f19a5d7b..1cc79e7c 100644 --- a/config/translation_maps/locations.xml +++ b/config/translation_maps/locations.xml @@ -699,7 +699,7 @@ Van Pelt - Featured Books--First Floor Van Pelt-Dietrich Library Center - Van Pelt - Featured Books--First Floor + Van Pelt - Featured Books--First Floor, see also table near Moelis Lounge Fisher Fine Arts Library From 953934e82b407913d874cbb39d37b73980755e4a Mon Sep 17 00:00:00 2001 From: Chris Clement Date: Mon, 11 Nov 2019 16:29:48 -0500 Subject: [PATCH 006/114] Fixed data offset issue that was hiding 'Request' link for the 101st item onward --- app/controllers/franklin_alma_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/franklin_alma_controller.rb b/app/controllers/franklin_alma_controller.rb index a915198b..1e36f7ea 100644 --- a/app/controllers/franklin_alma_controller.rb +++ b/app/controllers/franklin_alma_controller.rb @@ -329,7 +329,7 @@ def holding_items policies[data['policy']['value']] = nil pids_to_check << [data['pid'], data['policy']['value']] end - [data['policy']['value'], data['pid'], data['description'], due_date_policy || data['due_date_policy'], data['base_status']['desc'], data['barcode'], [], params['mms_id'], params['holding_id']] + [data['policy']['value'], data['pid'], data['description'], data['base_status']['desc'], data['barcode'], due_date_policy || data['due_date_policy'], [], params['mms_id'], params['holding_id']] } end From 42993936e41f0f0ddf8cc8176cc27ca0b286cdbf Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Thu, 5 Dec 2019 10:42:36 -0500 Subject: [PATCH 007/114] update collection news blog feed, per vallhonr --- app/controllers/collection_news_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/collection_news_controller.rb b/app/controllers/collection_news_controller.rb index 1e335094..a928c8f6 100644 --- a/app/controllers/collection_news_controller.rb +++ b/app/controllers/collection_news_controller.rb @@ -7,7 +7,7 @@ class CollectionNewsController < ApplicationController include RssProxy def index - rss_proxy('https://pennlibnews.wordpress.com/category/collection-news/feed/') + rss_proxy('http://www.library.upenn.edu/blogs/libraries-news/category/Collections/rss.xml') end end From 0ab8aae5978e57704a4d8ad187035ed7729475ce Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Mon, 9 Dec 2019 12:02:43 -0500 Subject: [PATCH 008/114] fix "More collection news" link; point to new blog --- app/views/catalog/_landing_bento.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/catalog/_landing_bento.html.erb b/app/views/catalog/_landing_bento.html.erb index 8f9f5047..73b0effb 100644 --- a/app/views/catalog/_landing_bento.html.erb +++ b/app/views/catalog/_landing_bento.html.erb @@ -49,7 +49,7 @@
- + From e8c65a1df956850e3180ae02813aece8d8b52d8a Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Mon, 23 Dec 2019 10:22:14 -0500 Subject: [PATCH 009/114] bookplates link to pantheon, not nebraska (per vallhonr) --- lib/penn_lib/marc.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/penn_lib/marc.rb b/lib/penn_lib/marc.rb index 097ca5fa..7f364afa 100644 --- a/lib/penn_lib/marc.rb +++ b/lib/penn_lib/marc.rb @@ -2374,7 +2374,7 @@ def get_web_link_display(rec) .split(/\W+/) .select { |word| !words_to_remove_from_web_link.member?(word.downcase) } .join('') - imagesource = "//www.library.upenn.edu/images/alum/bookplates/#{imagename}.gif" + imagesource = "//www.library.upenn.edu/sites/default/files/images/bookplates/#{imagename}.gif" links << { img_src: imagesource, img_alt: "#{linktext} Bookplate", From ac153ad75e70571ef71143aab60b61352d749baf Mon Sep 17 00:00:00 2001 From: Katherine Schultz Date: Tue, 7 Jan 2020 15:45:26 -0500 Subject: [PATCH 010/114] create new loc Featured Books Display in MPA library --- config/translation_maps/locations.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/translation_maps/locations.xml b/config/translation_maps/locations.xml index 1cc79e7c..ec72be8a 100644 --- a/config/translation_maps/locations.xml +++ b/config/translation_maps/locations.xml @@ -877,6 +877,11 @@ Math/Physics/Astronomy Library Math/Physics/Astronomy - Circulation Desk
+ + Math/Physics/Astronomy Library - Featured Books Display + Math/Physics/Astronomy Library + Math/Physics/Astronomy Library - Featured Books Display + Math/Physics/Astronomy Library - New Book Shelf Math/Physics/Astronomy Library From 63b86e74c08bf32ac78ba707929fb3ff22a73a15 Mon Sep 17 00:00:00 2001 From: Chris Clement Date: Fri, 24 Jan 2020 11:11:22 -0500 Subject: [PATCH 011/114] Added test_access flag to correct eresource linking --- app/assets/javascripts/availability.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/availability.js.erb b/app/assets/javascripts/availability.js.erb index ca108d2d..dee32edb 100644 --- a/app/assets/javascripts/availability.js.erb +++ b/app/assets/javascripts/availability.js.erb @@ -43,7 +43,7 @@ $(document).ready(function() { if (holding['activation_status'] == 'Available') { var url = null; if (holding['portfolio_pid']) { - url = "https://<%= ENV['ALMA_DELIVERY_DOMAIN'] %>/view/uresolver/<%= ENV['ALMA_INSTITUTION_CODE'] %>/openurl?Force_direct=true&portfolio_pid=" + + url = "https://<%= ENV['ALMA_DELIVERY_DOMAIN'] %>/view/uresolver/<%= ENV['ALMA_INSTITUTION_CODE'] %>/openurl?Force_direct=true&test_access=true&&portfolio_pid=" + holding['portfolio_pid'] + "&rfr_id=info%3Asid%2Fprimo.exlibrisgroup.com&u.ignore_date_coverage=true" } From 4e1331c79828c3451ab5919b99517b0f5e837af4 Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Wed, 5 Feb 2020 09:52:52 -0500 Subject: [PATCH 012/114] update database a-z list url --- app/views/catalog/_home_text.html.erb | 2 +- app/views/catalog/_landing_articles.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/catalog/_home_text.html.erb b/app/views/catalog/_home_text.html.erb index bb2e685a..522ef21b 100644 --- a/app/views/catalog/_home_text.html.erb +++ b/app/views/catalog/_home_text.html.erb @@ -16,7 +16,7 @@
  • Use Penn   Text Article Finder to find content subscribed to by Penn Libraries.
  • -
  • Browse databases by subject.
  • +
  • Browse databases by subject.
  • Image collections.
  • diff --git a/app/views/catalog/_landing_articles.html.erb b/app/views/catalog/_landing_articles.html.erb index 2af70fa4..437d4581 100644 --- a/app/views/catalog/_landing_articles.html.erb +++ b/app/views/catalog/_landing_articles.html.erb @@ -14,7 +14,7 @@ From 659d581258d3ab2f24823364d5405d04cb570ba7 Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Fri, 31 Jan 2020 13:48:37 -0500 Subject: [PATCH 013/114] add last-10-years publication date facet bucket --- app/models/franklin_indexer.rb | 2 +- lib/penn_lib/marc.rb | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/franklin_indexer.rb b/app/models/franklin_indexer.rb index 452c3039..d87278c1 100644 --- a/app/models/franklin_indexer.rb +++ b/app/models/franklin_indexer.rb @@ -354,7 +354,7 @@ def define_all_fields to_field 'publication_date_f_stored' do |rec, acc, ctx| val = ctx.clipboard.dig(:dates, :pub_date_decade) - acc << val if val + acc.concat(val.nil? ? [] : val) end to_field 'publication_dr' do |rec, acc, ctx| diff --git a/lib/penn_lib/marc.rb b/lib/penn_lib/marc.rb index 7f364afa..56fb07e0 100644 --- a/lib/penn_lib/marc.rb +++ b/lib/penn_lib/marc.rb @@ -952,9 +952,17 @@ def build_dates_hash(raw_pub_date_start, raw_pub_date_end = nil, content_date = content_date_end = pub_date_end end end + if current_year + 15 > pub_date_start.to_i + pub_date_decade = [ pub_date_start[0,3] + '0s' ] + if current_year - pub_date_start.to_i < 10 || current_year - pub_date_end.to_i < 10 + pub_date_decade << 'Last 10 years' + end + else + pub_date_decade = nil + end { :pub_date_sort => pub_date_start, - :pub_date_decade => current_year + 15 > pub_date_start.to_i ? pub_date_start[0,3] + '0s' : nil, + :pub_date_decade => pub_date_decade, :pub_date_range => "[#{pub_date_start} TO #{pub_date_end}]", :content_date_range => "[#{content_date_start} TO #{content_date_end}]", :pub_date_minsort => "#{pub_date_start}-01-01T00:00:00Z", From 331259d1a91a4c168d95b51b4c1734f142867117 Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Fri, 31 Jan 2020 13:49:13 -0500 Subject: [PATCH 014/114] filter out non-whitelisted "source specified" subject vocabs --- lib/penn_lib/marc.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/penn_lib/marc.rb b/lib/penn_lib/marc.rb index 56fb07e0..9c3656bd 100644 --- a/lib/penn_lib/marc.rb +++ b/lib/penn_lib/marc.rb @@ -341,7 +341,10 @@ def subject_codes_to_xfacet_prefixes def is_subject_field(field) # 10/2018 kms: add 2nd Ind 7 - subject_codes.member?(field.tag) && %w(0 2 4 7).member?(field.indicator2) + subject_codes.member?(field.tag) && (%w(0 2 4).member?(field.indicator2) || + (field.indicator2 == '7' && field.any? do |sf| + sf.code == '2' && %w(aat cct fast jlabsh lcsh lcstt lctgm local/osu mesh ndlsh nlksh).member?(sf.value) + end)) end def reject_pro_chr(sf) From 3014f546875800a67732392a3526b76c8f2da207 Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Fri, 31 Jan 2020 16:12:41 -0500 Subject: [PATCH 015/114] move "Penn Library Web" access facet to "Online library" location facet --- lib/penn_lib/marc.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/penn_lib/marc.rb b/lib/penn_lib/marc.rb index 9c3656bd..b8a011c1 100644 --- a/lib/penn_lib/marc.rb +++ b/lib/penn_lib/marc.rb @@ -712,12 +712,12 @@ def get_prt_count(rec) end def get_access_values(rec) - acc = rec.flat_map do |f| + acc = rec.map do |f| case f.tag when EnrichedMarc::TAG_HOLDING 'At the library' when EnrichedMarc::TAG_ELECTRONIC_INVENTORY - ['Online', 'Penn Library Web'] + 'Online' end end.compact acc += rec.fields('856') @@ -879,7 +879,7 @@ def holdings_location_mappings(rec, display_fieldname) # we don't facet for 'web' which is the 'Penn Library Web' location used in Voyager. # this location should eventually go away completely with data cleanup in Alma. - rec.fields(tag).flat_map do |field| + acc = rec.fields(tag).flat_map do |field| results = field.find_all { |sf| sf.code == subfield_code } .select { |sf| sf.value != 'web' } .map { |sf| @@ -893,6 +893,10 @@ def holdings_location_mappings(rec, display_fieldname) # flatten multiple 'library' values results.select(&:present?).flatten end.uniq + if rec.fields(EnrichedMarc::TAG_ELECTRONIC_INVENTORY).any? + acc << 'Online library' + end + return acc end def get_library_values(rec) From 5a4c33ac9a1aef3f175fba4650788172d67400a0 Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Mon, 24 Feb 2020 13:25:33 -0500 Subject: [PATCH 016/114] add separate "recently published" facet, based on actual date fields --- app/controllers/catalog_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index 452f2871..7b08da33 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -312,7 +312,12 @@ def expire_session config.add_facet_field 'language_f', label: 'Language', limit: 5, collapse: false, solr_params: @@MINCOUNT config.add_facet_field 'library_f', label: 'Library', limit: 5, collapse: false, solr_params: @@MINCOUNT config.add_facet_field 'specific_location_f', label: 'Specific location', limit: 5, solr_params: @@MINCOUNT - config.add_facet_field 'publication_date_f', label: 'Publication date', limit: 5, collapse: false, solr_params: @@MINCOUNT + config.add_facet_field 'recently_published', label: 'Recently published', collapse: false, solr_params: @@MINCOUNT, :query => { + :last_5_years => { label: 'Last 5 years', fq: "pub_max_dtsort:[#{Date.current.year - 4}-01-01T00:00:00Z TO *]" }, + :last_10_years => { label: 'Last 10 years', fq: "pub_max_dtsort:[#{Date.current.year - 9}-01-01T00:00:00Z TO *]" }, + :last_15_years => { label: 'Last 15 years', fq: "pub_max_dtsort:[#{Date.current.year - 14}-01-01T00:00:00Z TO *]" }, + } + config.add_facet_field 'publication_date_f', label: 'Publication date', limit: 5, solr_params: @@MINCOUNT config.add_facet_field 'classification_f', label: 'Classification', limit: 5, collapse: false, solr_params: @@MINCOUNT config.add_facet_field 'genre_f', label: 'Form/Genre', limit: 5, solr_params: @@MINCOUNT config.add_facet_field 'recently_added_f', label: 'Recently added', solr_params: @@MINCOUNT, :query => { From 4cf004d2e2383e2a578b986ddc7ca0d13c7d009a Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Mon, 24 Feb 2020 13:42:37 -0500 Subject: [PATCH 017/114] Revert "add last-10-years publication date facet bucket" This reverts commit 659d581258d3ab2f24823364d5405d04cb570ba7. will be handled instead by specific "recently published" facet based on pub_max date field --- app/models/franklin_indexer.rb | 2 +- lib/penn_lib/marc.rb | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/app/models/franklin_indexer.rb b/app/models/franklin_indexer.rb index d87278c1..452c3039 100644 --- a/app/models/franklin_indexer.rb +++ b/app/models/franklin_indexer.rb @@ -354,7 +354,7 @@ def define_all_fields to_field 'publication_date_f_stored' do |rec, acc, ctx| val = ctx.clipboard.dig(:dates, :pub_date_decade) - acc.concat(val.nil? ? [] : val) + acc << val if val end to_field 'publication_dr' do |rec, acc, ctx| diff --git a/lib/penn_lib/marc.rb b/lib/penn_lib/marc.rb index b8a011c1..9555b41f 100644 --- a/lib/penn_lib/marc.rb +++ b/lib/penn_lib/marc.rb @@ -959,17 +959,9 @@ def build_dates_hash(raw_pub_date_start, raw_pub_date_end = nil, content_date = content_date_end = pub_date_end end end - if current_year + 15 > pub_date_start.to_i - pub_date_decade = [ pub_date_start[0,3] + '0s' ] - if current_year - pub_date_start.to_i < 10 || current_year - pub_date_end.to_i < 10 - pub_date_decade << 'Last 10 years' - end - else - pub_date_decade = nil - end { :pub_date_sort => pub_date_start, - :pub_date_decade => pub_date_decade, + :pub_date_decade => current_year + 15 > pub_date_start.to_i ? pub_date_start[0,3] + '0s' : nil, :pub_date_range => "[#{pub_date_start} TO #{pub_date_end}]", :content_date_range => "[#{content_date_start} TO #{content_date_end}]", :pub_date_minsort => "#{pub_date_start}-01-01T00:00:00Z", From 5f712a9082a28676342242e095075a88d468fcf6 Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Mon, 24 Feb 2020 13:44:18 -0500 Subject: [PATCH 018/114] also whitelist subject display terms where source thesaurus specified --- lib/penn_lib/marc.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/penn_lib/marc.rb b/lib/penn_lib/marc.rb index 9555b41f..699debdb 100644 --- a/lib/penn_lib/marc.rb +++ b/lib/penn_lib/marc.rb @@ -506,7 +506,9 @@ def get_subjects_from_600s_and_800(rec, indicator2) acc += rec.fields .select { |f| subject_600s.member?(f.tag) || (f.tag == '880' && has_subfield6_value(f, /^(#{subject_600s.join('|')})/)) } - .select { |f| f.indicator2 == indicator2 || (f.indicator2 == '7' && indicator2 == '0') } + .select { |f| f.indicator2 == indicator2 || (f.indicator2 == '7' && indicator2 == '0' && f.any? do |sf| + sf.code == '2' && %w(aat cct fast jlabsh lcsh lcstt lctgm local/osu mesh ndlsh nlksh).member?(sf.value) + end)} .map do |field| #added 2017/04/10: filter out 0 (authority record numbers) added by Alma value_for_link = join_subfields(field, &subfield_not_in(%w{0 6 8 2 e w})) From adf610c007817f9a177d1f91953df1fdf5605a52 Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Mon, 24 Feb 2020 14:08:05 -0500 Subject: [PATCH 019/114] prevent duplicate subjects from being displayed no differentiation in source/type/ontology for now; they're just strings, linked/searched as strings, so there is no point whatsoever in duplicating them for display. --- lib/penn_lib/marc.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/penn_lib/marc.rb b/lib/penn_lib/marc.rb index 699debdb..a767eb8c 100644 --- a/lib/penn_lib/marc.rb +++ b/lib/penn_lib/marc.rb @@ -499,6 +499,7 @@ def subject_69X # 11/2018: add 69x as local subj, add 650 _7 as subj def get_subjects_from_600s_and_800(rec, indicator2) + track_dups = Set.new acc = [] if %w{0 1 2}.member?(indicator2) #Subjects, Childrens subjects, and Medical Subjects all share this code @@ -527,7 +528,7 @@ def get_subjects_from_600s_and_800(rec, indicator2) link_type: 'subject_xfacet2' } end - end.compact + end.compact.select { |val| track_dups.add?(val) } elsif indicator2 == '4' # Local subjects # either a tag in subject_600s list with ind2==4, or a tag in subject_69X list with any ind2. @@ -557,7 +558,7 @@ def get_subjects_from_600s_and_800(rec, indicator2) link_type: 'subject_search' } end - end.compact + end.compact.select { |val| track_dups.add?(val) } end acc end From 805fc230ecad8de5aa42707c0421806f57a9346e Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Mon, 24 Feb 2020 14:15:43 -0500 Subject: [PATCH 020/114] add top-level catch-all "Veterinary" library alias --- config/translation_maps/locations.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/config/translation_maps/locations.xml b/config/translation_maps/locations.xml index ec72be8a..f57d9321 100644 --- a/config/translation_maps/locations.xml +++ b/config/translation_maps/locations.xml @@ -1031,18 +1031,21 @@ Veterinary: du Pont Library (New Bolton) Health Sciences Libraries + Veterinary Veterinary: du Pont Library (New Bolton) Veterinary: du Pont Library (New Bolton) Veterinary: du Pont Library (New Bolton) - Circulation Desk Health Sciences Libraries + Veterinary Veterinary: du Pont Library (New Bolton) Veterinary: du Pont Library (New Bolton) - Circulation Desk Veterinary: du Pont Library (New Bolton) - Office Health Sciences Libraries + Veterinary Veterinary: du Pont Library (New Bolton) Veterinary: du Pont Library (New Bolton) - Office @@ -1056,12 +1059,14 @@ Veterinary: du Pont Library (New Bolton) - Reference Health Sciences Libraries + Veterinary Veterinary: du Pont Library (New Bolton) Veterinary: du Pont Library (New Bolton) - Reference Veterinary: du Pont Library (New Bolton) - Reserve Health Sciences Libraries + Veterinary Veterinary: du Pont Library (New Bolton) Reserve Veterinary: du Pont Library (New Bolton) - Reserve @@ -1131,6 +1136,7 @@ On Order Health Sciences Libraries + Veterinary Veterinary: du Pont Library (New Bolton) Ordered for New Bolton Library @@ -1152,6 +1158,7 @@ On Order Health Sciences Libraries + Veterinary Ordered for Veterinary: Atwood Library (Campus) @@ -1745,42 +1752,49 @@ Veterinary: Atwood Library (Campus) Health Sciences Libraries + Veterinary Veterinary: Atwood Library (Campus) Veterinary: Atwood Library (Campus) Veterinary: Atwood Library (Campus) - Display Health Sciences Libraries + Veterinary Veterinary: Atwood Library (Campus) Veterinary: Atwood Library (Campus) - Display Veterinary: Atwood Library (Campus) - Librarian's Office Health Sciences Libraries + Veterinary Veterinary: Atwood Library (Campus) Veterinary: Atwood Library (Campus) - Librarian's Office Veterinary: Atwood Library (Campus) - Oversize Health Sciences Libraries + Veterinary Veterinary: Atwood Library (Campus) Veterinary: Atwood Library (Campus) - Oversize Veterinary: Atwood Library (Campus) - Reference Health Sciences Libraries + Veterinary Veterinary: Atwood Library (Campus) Veterinary: Atwood Library (Campus) - Reference Veterinary: Atwood Library (Campus) - Reference Oversize Health Sciences Libraries + Veterinary Veterinary: Atwood Library (Campus) Veterinary: Atwood Library (Campus) - Reference Oversize Veterinary: Atwood Library (Campus) - Reserve Health Sciences Libraries + Veterinary Veterinary: Atwood Library (Campus) Reserve Veterinary: Atwood Library (Campus) - Reserve @@ -1788,6 +1802,7 @@ Veterinary: Atwood Library (Campus) - Reserve Oversize Health Sciences Libraries + Veterinary Veterinary: Atwood Library (Campus) Reserve Veterinary: Atwood Library (Campus) - Reserve Oversize From b780c4f0b0bdb455690ded7ccfb8517d27658844 Mon Sep 17 00:00:00 2001 From: Chris Clement Date: Mon, 16 Mar 2020 11:25:51 -0400 Subject: [PATCH 021/114] Removed linking to physical item services --- app/assets/javascripts/availability.js.erb | 11 ++++-- app/controllers/franklin_alma_controller.rb | 40 +++++++++++---------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/app/assets/javascripts/availability.js.erb b/app/assets/javascripts/availability.js.erb index dee32edb..2aa3e74f 100644 --- a/app/assets/javascripts/availability.js.erb +++ b/app/assets/javascripts/availability.js.erb @@ -14,6 +14,9 @@ $(document).ready(function() { } function constructAeonLink(mmsid, holding) { + // TODO: remove this line once the libraries are open again + return null; + if(holding['link_to_aeon']) { return 'Request to view'; } @@ -113,7 +116,9 @@ $(document).ready(function() { var requests = globaldata[data[i][7]]; if(validRequestTypes.indexOf(requests[0]) != -1) { renderdata[mmsid].push(data[i][7]); - data[i][5][0] = "Request"; +// TODO: Uncomment when libraries reopen + //data[i][5][0] = "Request"; + data[i][5][0] = ""; table.row(i).invalidate().draw(); } } @@ -294,7 +299,9 @@ $(document).ready(function() { var requests = globaldata[data[i][0]]; if(validRequestTypes.indexOf(requests[0]) != -1) { renderdata[mmsid].push(data[i][0]); - data[i][5].push("Request"); +// TODO: Uncomment when libraries reopen + //data[i][5].push("Request"); + data[i][5].push(""); table.row(i).invalidate().draw(); } } diff --git a/app/controllers/franklin_alma_controller.rb b/app/controllers/franklin_alma_controller.rb index 1e36f7ea..78c670ec 100644 --- a/app/controllers/franklin_alma_controller.rb +++ b/app/controllers/franklin_alma_controller.rb @@ -218,7 +218,8 @@ def single_availability else bib_data['availability'][mmsid]['holdings'].each do |holding| links = [] - links << "Request to view in reading room" if holding['link_to_aeon'] +# TODO: Uncomment when libraries reopen + #links << "Request to view in reading room" if holding['link_to_aeon'] holding['availability'] = availability_status[holding['availability']] || 'Requestable' if has_holding_info @@ -345,11 +346,12 @@ def holding_items end policies[policy] = "/alma/request/?mms_id=%{mms_id}&holding_id=%{holding_id}&item_pid=%{item_pid}" unless not_requestable } - table_data.each { |item| policy = item.shift() request_url = (policies[policy] || '') % params.merge({:item_pid => item[0]}) - item[5] << "Request" unless (request_url.empty? || item[2] != 'Item in place') +# TODO: Uncomment when libraries reopen + #item[5] << "Request" unless (request_url.empty? || item[2] != 'Item in place') + item[5] << "" unless (request_url.empty? || item[2] != 'Item in place') } render :json => {"data": table_data} @@ -371,15 +373,16 @@ def request_options nil else case option['type']['value'] - when 'HOLD' - { - :option_name => 'Request', - #:option_url => option['request_url'], - :option_url => "/alma/request?mms_id=#{params['mms_id']}", - :avail_for_physical => true, - :avail_for_electronic => true, - :highlightable => true - } +# TODO: Uncomment when libraries reopen + #when 'HOLD' + #{ + #:option_name => 'Request', + ##:option_url => option['request_url'], + #:option_url => "/alma/request?mms_id=#{params['mms_id']}", + #:avail_for_physical => true, + #:avail_for_electronic => true, + #:highlightable => true + #} when 'GES' option_url = option['request_url'] if option_url.index('?') @@ -434,12 +437,13 @@ def request_options end } - results.append({ - :option_name => "Books By Mail", - :option_url => "https://franklin.library.upenn.edu/redir/booksbymail?bibid=#{params['mms_id']}", - :avail_for_physical => true, - :avail_for_electronic => false - }) if ['Athenaeum Member','Faculty','Faculty Express','Grad Student','Library Staff'].member?(session['user_group']) +# TODO: Uncomment when libraries reopen + #results.append({ + #:option_name => "Books By Mail", + #:option_url => "https://franklin.library.upenn.edu/redir/booksbymail?bibid=#{params['mms_id']}", + #:avail_for_physical => true, + #:avail_for_electronic => false + #}) if ['Athenaeum Member','Faculty','Faculty Express','Grad Student','Library Staff'].member?(session['user_group']) render :json => results end From 15470ae20468eeae15fcf6b82525b7bf84bcce89 Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Tue, 24 Mar 2020 12:42:42 -0400 Subject: [PATCH 022/114] removed call to deprecated franklin_alerts, per ivangold --- app/views/shared/_footer.html.erb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/shared/_footer.html.erb b/app/views/shared/_footer.html.erb index a8c212b6..cdc932e5 100644 --- a/app/views/shared/_footer.html.erb +++ b/app/views/shared/_footer.html.erb @@ -91,5 +91,3 @@ - - From 10388a0b90ac7537ca81b846abf9aefdaf029218 Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Tue, 24 Mar 2020 12:46:29 -0400 Subject: [PATCH 023/114] hotfix: only proxy "View and filter" link when user has proxy-equivalent auth --- app/assets/javascripts/login-ezproxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/login-ezproxy.js b/app/assets/javascripts/login-ezproxy.js index 140ac3eb..53a36ca0 100644 --- a/app/assets/javascripts/login-ezproxy.js +++ b/app/assets/javascripts/login-ezproxy.js @@ -45,7 +45,7 @@ $(document).ready(function() { var proxyUrl = PROXY_PREPEND + 'http://127.0.0.1:8082/?redirect=' + encodeURIComponent(currentUrl); $(div).find(".ezproxy-login-link").attr("href", proxyUrl); - if (auth !== null && auth !== undefined) { + if (auth !== null && auth !== undefined && auth.loggedIn) { $(div).find(".view-and-filter").find("a").each(function (idx, element) { // ezproxy handles url param specifically so we don't need to escape it var viewAndFilterUrl = $(element).attr("href"); From 461857289a4c83c1fa1334044ab7c74fa8fbdef0 Mon Sep 17 00:00:00 2001 From: Michael Gibney Date: Wed, 25 Mar 2020 16:47:32 -0400 Subject: [PATCH 024/114] temporarily add links to hathi records corresponding to local holdings --- app/controllers/catalog_controller.rb | 6 +++--- app/helpers/document_render_helper.rb | 15 ++++++++++++++- app/views/catalog/_show_expanded.html.erb | 4 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index 7b08da33..d1994175 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -134,7 +134,7 @@ def expire_session 'facet.mincount': 0, # fq: '{!tag=cluster}{!collapse field=cluster_id nullPolicy=expand size=5000000 min=record_source_id}', # this approach needs expand.field=cluster_id - fq: %q~{!tag=cluster}NOT ({!join from=cluster_id to=cluster_id v='record_source_f:"Penn"'} AND record_source_f:"HathiTrust")~, + fq: %q~{!tag=cluster}NOT ({!join from=cluster_id to=cluster_id v='record_source_f:"Penn"'} AND record_source_f:"HathiTrust") NOT record_source_id:3~, expand: 'true', 'expand.field': 'cluster_id', 'expand.q': '*:*', @@ -298,11 +298,11 @@ def expire_session 'Other' => { :label => 'Other', :fq => "{!tag=azlist ex=azlist}title_xfacet:/[ -`{-~].*/"} } config.add_facet_field 'access_f', label: 'Access', collapse: false, solr_params: @@MINCOUNT, query: { - 'Online' => { :label => 'Online', :fq => "{!join from=cluster_id to=cluster_id v='{!term f=access_f v=\\'Online\\'}'}"}, + 'Online' => { :label => 'Online', :fq => "{!join from=cluster_id to=cluster_id v='access_f:Online OR record_source_id:3'}"}, 'At the library' => { :label => 'At the library', :fq => "{!join from=cluster_id to=cluster_id v='{!term f=access_f v=\\'At the library\\'}'}"} } config.add_facet_field 'record_source_f', label: 'Record Source', collapse: false, solr_params: @@MINCOUNT, query: { - 'HathiTrust' => { :label => 'HathiTrust', :fq => "{!join from=cluster_id to=cluster_id v='{!term f=record_source_f v=\\'HathiTrust\\'}'}"}, + 'HathiTrust' => { :label => 'HathiTrust', :fq => "{!join from=cluster_id to=cluster_id v='{!terms f=record_source_id v=2,3}'}"}, 'Penn' => { :label => 'Penn', :fq => "{!join from=cluster_id to=cluster_id v='{!term f=record_source_f v=\\'Penn\\'}'}"} } config.add_facet_field 'format_f', label: 'Format', limit: 5, collapse: false, solr_params: @@MINCOUNT diff --git a/app/helpers/document_render_helper.rb b/app/helpers/document_render_helper.rb index 48ef5657..77ca4e63 100644 --- a/app/helpers/document_render_helper.rb +++ b/app/helpers/document_render_helper.rb @@ -51,12 +51,20 @@ def render_electronic_holdings_links(electronic_holdings_str) end end + @@HATHI_TMP_TEXT = 'HathiTrust Digital Library Login for full text' + @@HATHI_REPLACEMENT_TEXT = 'COVID-19 Special Access from HathiTrust — Login for full text' + @@HATHI_LOGIN_PREFIX = 'https://babel.hathitrust.org/Shibboleth.sso/Login?entityID=https://idp.pennkey.upenn.edu/idp/shibboleth&target=https%3A%2F%2Fbabel.hathitrust.org%2Fcgi%2Fping%2Fpong%3Ftarget%3D' + def render_online_resource_display_for_index_view(options) values = options[:value] values.map do |value| JSON.parse(value).map do |link_struct| url = link_struct['linkurl'] text = link_struct['linktext'] + if text == @@HATHI_TMP_TEXT + text = @@HATHI_REPLACEMENT_TEXT + url = @@HATHI_LOGIN_PREFIX + URI.encode_www_form_component(url) + end %Q{#{text}} end.join('
    ') end.join('
    ').html_safe @@ -69,11 +77,16 @@ def render_online_display_for_show_view(options) JSON.parse(value).map do |link_struct| url = link_struct['linkurl'] text = link_struct['linktext'] + orig_url = url + if text == @@HATHI_TMP_TEXT + text = @@HATHI_REPLACEMENT_TEXT + url = @@HATHI_LOGIN_PREFIX + URI.encode_www_form_component(url) + end html = %Q{ - diff --git a/app/views/layouts/_colenda_ajax_results_wrapper.html.erb b/app/views/layouts/_colenda_ajax_results_wrapper.html.erb new file mode 100644 index 00000000..b0166f50 --- /dev/null +++ b/app/views/layouts/_colenda_ajax_results_wrapper.html.erb @@ -0,0 +1,14 @@ +
    + <%= link_to "View and filter #{number_with_delimiter(results.total_items)} #{results.total_items != 1 ? 'results' : 'result'}", databases_results_url(params[:q] || params[:query]) %> +
    + +<%= yield %> + +<% if results.total_items > 0 %> +
    + <%= link_to(("View all results #{image_tag('view_all_arrow.png', :alt => '')}").html_safe, databases_results_url(params[:q] || params[:query])) %> +
    +<% end %> + +
    +
    diff --git a/app/views/layouts/_hide_colenda_zero_results.html.erb b/app/views/layouts/_hide_colenda_zero_results.html.erb new file mode 100644 index 00000000..d87d1eec --- /dev/null +++ b/app/views/layouts/_hide_colenda_zero_results.html.erb @@ -0,0 +1,6 @@ + diff --git a/config/initializers/bento_search.rb b/config/initializers/bento_search.rb index c368088d..b4cb122e 100644 --- a/config/initializers/bento_search.rb +++ b/config/initializers/bento_search.rb @@ -56,6 +56,15 @@ end end +BentoSearch.register_engine('colenda') do |conf| + conf.engine = 'BentoSearch::ColendaEngine' + conf.allow_routable_results = true + conf.for_display do |display| + display[:ajax] = { 'wrapper_template' => 'layouts/colenda_ajax_results_wrapper' } + display[:no_results_partial] = 'layouts/hide_colenda_zero_results' + end +end + BentoSearch.register_engine('catalog') do |conf| conf.engine = 'BentoSearch::CatalogEngine' conf.allow_routable_results = true From 3a12e5de489b4e6fd3bdffdd3e23959478f62dde Mon Sep 17 00:00:00 2001 From: Iva Goldsmith Date: Tue, 26 May 2020 15:46:19 -0400 Subject: [PATCH 067/114] Add colenda tab --- app/helpers/application_helper.rb | 8 ++++++++ app/views/catalog/_franklin_search_bar.html.erb | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f8bd86d6..cc3dee40 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -23,6 +23,10 @@ def google_site_search_results_url(query) return "https://www.library.upenn.edu/search/web-pages?q=#{query}" end + def colenda_search_results_url(query) + return "https://colenda.library.upenn.edu/catalog?q=#{query}" + end + def catalog_results_url(query) return search_catalog_path(q: query, search_field: 'keyword') end @@ -65,6 +69,10 @@ def render_tab_link(tab_id, tab_label, anchor, url, data_target) attrs = { 'href': "http://www.library.upenn.edu/search/web-pages" } + elsif tab_id == 'colenda' && action_name == 'landing' + attrs = { + 'href': "https://colenda.library.upenn.edu" + } else attrs = { 'href': anchor, diff --git a/app/views/catalog/_franklin_search_bar.html.erb b/app/views/catalog/_franklin_search_bar.html.erb index 396f8046..89e0f086 100644 --- a/app/views/catalog/_franklin_search_bar.html.erb +++ b/app/views/catalog/_franklin_search_bar.html.erb @@ -46,6 +46,11 @@ <%= link_to 'Databases', databases_results_path(params[:q]) %> +