Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into pod-local
Browse files Browse the repository at this point in the history
  • Loading branch information
magibney committed Sep 21, 2020
2 parents b263a29 + 0a3159e commit a9a34cb
Show file tree
Hide file tree
Showing 106 changed files with 1,369 additions and 1,338 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ local_dev_env
.idea

public/assets

.byebug_history
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.3.3
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,5 @@ gem 'blacklight-ris', :git => 'https://github.com/upenn-libraries/blacklight-ris
gem 'oga'

gem 'httparty'

gem 'honeybadger'
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ GEM
globalid (0.3.7)
activesupport (>= 4.1.0)
hashie (3.6.0)
honeybadger (4.7.2)
htmlentities (4.3.4)
httparty (0.16.4)
mime-types (~> 3.0)
Expand Down Expand Up @@ -390,6 +391,7 @@ DEPENDENCIES
dotenv-rails
font-awesome-rails
globalid (= 0.3.7)
honeybadger
httparty
jbuilder (= 2.6.0)
jdbc-sqlite3 (= 3.8.11.2)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ Installation:

- Checkout this repo.

- Make sure you have ruby 2.3.1 installed. It's recommended that you
- Make sure you have ruby 2.3.3 installed. It's recommended that you
use [rbenv](https://github.com/rbenv/rbenv), but it may be
quicker/easier to get running with [rvm](https://rvm.io/).
- You may have issues installing Ruby 2.3.3 in recent Linux distributions due to an OpenSSL version incompatibility. See [this guide](https://www.garron.me/en/linux/install-ruby-2-3-3-ubuntu.html) for help.

- Run `bundle install` to install all gem dependencies.

Expand Down
Binary file removed app/assets/images/amanpreet_kaur.jpg
Binary file not shown.
Binary file removed app/assets/images/anne_larrivee.jpg
Binary file not shown.
Binary file removed app/assets/images/arthur_kiron.jpg
Binary file not shown.
Binary file removed app/assets/images/brian_vivier.jpg
Binary file not shown.
Binary file removed app/assets/images/bruce_nielsen.jpg
Binary file not shown.
Binary file removed app/assets/images/carlos_rodriguez.jpg
Binary file not shown.
Binary file removed app/assets/images/cathy_ogur.jpg
Binary file not shown.
Binary file removed app/assets/images/charles_cobine.jpg
Binary file not shown.
Binary file removed app/assets/images/cynthia_cronin_kardon.jpg
Binary file not shown.
Binary file removed app/assets/images/david_azzolina.jpg
Binary file not shown.
Binary file removed app/assets/images/david_mcknight.jpg
Binary file not shown.
Binary file removed app/assets/images/deborah_stewart.jpg
Binary file not shown.
Binary file removed app/assets/images/dee_crandall.jpg
Binary file not shown.
Binary file removed app/assets/images/dot_porter.jpg
Binary file not shown.
Binary file removed app/assets/images/douglas_mcgee.jpg
Binary file not shown.
Binary file removed app/assets/images/feedback.png
Binary file not shown.
Binary file removed app/assets/images/frank_campbell.jpg
Binary file not shown.
Binary file removed app/assets/images/girmaye_misgna.jpg
Binary file not shown.
Binary file removed app/assets/images/gwen_collaco.jpg
Binary file not shown.
Binary file removed app/assets/images/hannah_bennett.jpg
Binary file not shown.
Binary file removed app/assets/images/jef_pierce.jpg
Binary file not shown.
Binary file removed app/assets/images/joseph_holub.jpg
Binary file not shown.
Binary file removed app/assets/images/judith_currano.jpg
Binary file not shown.
Binary file removed app/assets/images/kenny_whitebloom.jpg
Binary file not shown.
Binary file removed app/assets/images/laurel_graham.jpg
Binary file not shown.
Binary file removed app/assets/images/lauren_gala.jpg
Diff not rendered.
Binary file removed app/assets/images/lauris_olson.jpg
Diff not rendered.
Binary file removed app/assets/images/liza_vick.jpg
Diff not rendered.
Binary file removed app/assets/images/lynn_ransom.jpg
Diff not rendered.
Binary file removed app/assets/images/lynne_farrington.jpg
Diff not rendered.
Binary file removed app/assets/images/manuel_de_la_cruz_gutierrez.jpg
Diff not rendered.
Binary file removed app/assets/images/marcella_barnhart.jpg
Diff not rendered.
Binary file removed app/assets/images/margaret_janz.jpg
Diff not rendered.
Binary file removed app/assets/images/margy_lindem.jpg
Diff not rendered.
Binary file removed app/assets/images/maylene_qiu.jpg
Diff not rendered.
Binary file removed app/assets/images/melanie_cedrone.jpg
Diff not rendered.
Binary file removed app/assets/images/mia_wells.jpg
Diff not rendered.
Binary file removed app/assets/images/mitch_fraas.jpg
Diff not rendered.
Binary file removed app/assets/images/molly_des_jardin.jpg
Diff not rendered.
Binary file removed app/assets/images/nicholas_herman.jpg
Diff not rendered.
Binary file removed app/assets/images/nick_okrent.jpg
Diff not rendered.
Binary file removed app/assets/images/patricia_guardiola.jpg
Diff not rendered.
Binary file removed app/assets/images/patty_lynn.jpg
Diff not rendered.
Binary file removed app/assets/images/rebecca_stuhr.jpg
Diff not rendered.
Binary file removed app/assets/images/richard_james.jpg
Diff not rendered.
Binary file removed app/assets/images/samantha_kirk.jpg
Diff not rendered.
Binary file removed app/assets/images/sarah_wipperman.jpg
Diff not rendered.
Binary file removed app/assets/images/sharon_black.jpg
Diff not rendered.
Binary file removed app/assets/images/sherry_morgan.jpg
Diff not rendered.
Binary file removed app/assets/images/vickie_karasic.jpg
Diff not rendered.
Binary file removed app/assets/images/william_noel.jpg
Diff not rendered.
118 changes: 95 additions & 23 deletions app/assets/javascripts/availability.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ var validRequestTypes = ["CentralCAT","MAINT-EC","CHI CAT","CatMet","HEB CAT",
"Jap-KorCAT","MUSIC CAT","MidEastCat","SASIA CAT",
"SCPC CAT","SLAV CAT","BindRepair","MAINT-enh",
"MAINT-otf","MAINT-tr"];
$.fn.dataTable.ext.errMode = 'none';
$.fn.dataTable.ext.errMode = 'none';

// Hackily parses relevant context out of the DOM for the specified mmsid
function get_request_context(mmsid) {
return {
pickupable: null,
hathi_etas: (document.getElementById('hathi_etas-'+mmsid) != null),
hathi_pd: (document.getElementById('hathi_pd-'+mmsid) != null),
monograph: (document.getElementById('monograph-'+mmsid) != null)
};
}

$(document).ready(function() {

Expand All @@ -13,7 +23,16 @@ $(document).ready(function() {
BlacklightAlma.call(this);
}

function constructAeonLink(mmsid, holding) {
// Based on hackily-parsed DOM context, determine whether the Pickup@Penn link should be suppressed
function disable_pickup_at_penn(ctx) {
return ctx.monograph && (ctx.pickupable === false || ctx.hathi_etas /*|| ctx.hathi_pd*/);
}

function constructAeonLink(mmsid, holding, ctx) {
if (ctx.hathi_etas && ctx.monograph) {
return null;
}

if(holding['link_to_aeon']) {
return '<a href="/redir/aeon?bibid=' + mmsid + '&hldid=' + holding['holding_id'] + '" target="_blank">Request to view</a>';
}
Expand All @@ -24,17 +43,24 @@ $(document).ready(function() {
Franklin.prototype = Object.create(BlacklightAlma.prototype);

Franklin.prototype.formatHolding = function (mms_id, holding) {
var ctx = get_request_context(mms_id);
if (holding['inventory_type'] == 'physical') {
var availability = "Unknown";
if (holding['availability'] == 'check_holdings') {
availability = "See options";
} else if (holding['availability'] == 'unavailable') {
availability = "See request options";
// pre-COVID-19 always mapped to "See request options";
if (holding['link_to_aeon']) {
// Aeon materials show as "unavailable", but not in the sense of being unviewable.
availability = (ctx.hathi_etas && ctx.monograph) ? "Restricted (COVID-19)" : "See request options";
} else {
availability = "Unavailable";
}
} else if (holding['availability'] == 'available') {
availability = "Available";
availability = disable_pickup_at_penn(ctx) ? "Restricted (COVID-19)" : "Available";
}
// TODO: pass in format to shelfLocatorLink() somehow
return [availability, holding['location'], holding['call_number'], $.shelfLocatorLink(mms_id, holding, "TODO"), constructAeonLink(mms_id, holding)]
return [availability, holding['location'], holding['call_number'], $.shelfLocatorLink(mms_id, holding, "TODO"), constructAeonLink(mms_id, holding, ctx)]
.filter(function (item) {
return item != null && item.length > 0;
}).join(". ");
Expand All @@ -43,7 +69,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"
}

Expand Down Expand Up @@ -75,7 +101,8 @@ $(document).ready(function() {
};

Franklin.prototype.loadRequestOptionsAjax = function(mmsid) {
var url = "/alma/single_availability.json?mms_id=" + encodeURIComponent(mmsid);
var request_context = get_request_context(mmsid);
var url = "/alma/single_availability.json?mms_id=" + encodeURIComponent(mmsid) + "&request_context=" + encodeURIComponent(JSON.stringify(request_context));

$('#requestOptions-' + mmsid).on('error.dt', function(e, settings, techNote, message) {
$(this).dataTable().fnSettings().oLanguage.sEmptyTable = 'An error has occurred.';
Expand All @@ -86,7 +113,7 @@ $(document).ready(function() {
$.get(url, function(data) {
globaldata = $.extend({}, globaldata, data["metadata"]);
callback({"data": data["data"]});
Franklin.prototype.loadRequestOptionListAjax(mmsid);
Franklin.prototype.loadRequestOptionListAjax(mmsid, request_context);
});
},
"processing": true,
Expand All @@ -113,10 +140,11 @@ $(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] = "<a target='_blank' href='/alma/request?mms_id=" + mmsid + "&holding_id=" + data[i][6] + "&item_pid=" + data[i][7] + "'>Request</a>";
// TODO: when libraries reopen: remove conditional, Pickup@Penn=>Request
data[i][5][0] = disable_pickup_at_penn(request_context) ? "" : "<a target='_blank' href='/alma/request?mms_id=" + mmsid + "&holding_id=" + data[i][6] + "&item_pid=" + data[i][7] + "'>Pickup@Penn</a>";
table.row(i).invalidate().draw();
}
}
}
}
}

Expand Down Expand Up @@ -198,18 +226,59 @@ $(document).ready(function() {
});
};

Franklin.prototype.loadRequestOptionListAjax = function(mmsid) {
Franklin.prototype.loadRequestOptionListAjax = function(mmsid, request_context) {
request_context.pickupable = globaldata[mmsid]["pickupable"];
$.ajax({
url: "/alma/request_options.json?mms_id="+mmsid,
url: "/alma/request_options.json?mms_id="+mmsid+"&request_context="+encodeURIComponent(JSON.stringify(request_context)),
success: function(data, textStatus, jqXHR) {
var optionList = $('#requestOptionList-' + mmsid);

if(globaldata[mmsid]["facultyexpress"]) {
for(i = 0; i < data.length; i++) {
if(data[i]['option_name'] == 'Interlibrary Loan') {
data[i]['option_name'] = 'FacultyEXPRESS';
var openUrlTemplate = null; // grab openUrl params from here if necessary
var registeredFacEx = globaldata[mmsid]['facultyexpress'] ? false : null; // null if not applicable
var booksByMailOption = null;
for(var i = 0; i < data.length && (openUrlTemplate === null || booksByMailOption === null || registeredFacEx === false); i++) {
var requestOption = data[i];
switch (requestOption['option_name']) {
case 'Interlibrary Loan':
openUrlTemplate = requestOption['option_url'];
if (registeredFacEx === false) { // careful! must distinguish from "falsey" null
requestOption['option_name'] = 'FacultyEXPRESS';
registeredFacEx = true;
}
break;
}
case 'Request Digital Delivery':
if (openUrlTemplate === null) {
// provisionally grab openUrl from here, but prefer from ILL if present for consistency
openUrlTemplate = requestOption['option_url'];
}
break;
case 'Books By Mail':
booksByMailOption = requestOption;
break;
}
}
if ((registeredFacEx === false || booksByMailOption != null) && (!request_context.monograph || !request_context.hathi_etas)) {
// assume first querystring param is 'requesttype=[...]' -- subsequent options (preceded by '&') should be openUrl params
var startOpenUrlParams = openUrlTemplate === null ? -1 : openUrlTemplate.indexOf('&');
if (startOpenUrlParams < 0) {
appendOpenUrlParams = '';
} else {
appendOpenUrlParams = openUrlTemplate.slice(startOpenUrlParams);
}
if (registeredFacEx === false) {
data.push({
option_name: 'FacultyEXPRESS',
option_url: 'https://franklin.library.upenn.edu/forms/ill?requesttype=book' + appendOpenUrlParams,
highlightable: true
});
}
if (booksByMailOption != null) {
// NOTE: we're conjuring an ILL link that would normally be generated by Alma, but is not now (COVID-19) because
// ILL-proper is disabled. Despite appearances, 80% confident that requesttype should always be "book" (e.g., even
// for "journals"), because "book" differentiates from things like reprographic requests, _not_ actually based on
// bibliographic material type. 'deliverytype=bbm' is handled in the ill form (franklinforms) to prepend "BBM " to
// otherwise-normal ILL requests (saving staff manually doing so); such ILL requests are then handled as BBM requests.
booksByMailOption['option_url'] = 'https://franklin.library.upenn.edu/forms/ill?requesttype=book&deliverytype=bbm' + appendOpenUrlParams;
}
}

Expand Down Expand Up @@ -246,9 +315,8 @@ $(document).ready(function() {
containingdiv.appendTo(optionList);
});
$('#request-options-spinner-' + mmsid).remove();
console.log(data);
}
});
});
};

Franklin.prototype.loadRequestOptions = function() {
Expand Down Expand Up @@ -294,6 +362,7 @@ $(document).ready(function() {
"emptyTable": "No item data available"
},
"drawCallback": function(settings) {
var request_context = get_request_context(mmsid);
var table = $('#holdingItems-' + mmsid).DataTable();
var pageSize = table.settings()[0]['_iDisplayLength'];
var tableLen = table.data().length;
Expand All @@ -305,10 +374,11 @@ $(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("<a target='_blank' href='/alma/request?mms_id=" + data[i][6] + "&holding_id=" + data[i][7] + "&item_pid=" + data[i][0] + "'>Request</a>");
// TODO: when libraries reopen: remove conditional, Pickup@Penn=>Request
data[i][5].push(disable_pickup_at_penn(request_context) ? "" : "<a target='_blank' href='/alma/request?mms_id=" + data[i][6] + "&holding_id=" + data[i][7] + "&item_pid=" + data[i][0] + "'>Pickup@Penn</a>");
table.row(i).invalidate().draw();
}
}
}
}
}

Expand Down Expand Up @@ -352,11 +422,13 @@ $(document).ready(function() {
ba.loadRequestOptions();
});

function loadItems(mms_id, holding_id, location_code) {
function loadItems(mms_id, holding_id, location_code, pickupable) {
var request_context = get_request_context(mms_id);
request_context.pickupable = pickupable;
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 + "&current_location=" + location_code).load();
holdingItemsTable.ajax.url('/alma/holding_items.json?mms_id=' + mms_id + "&holding_id=" + holding_id + "&current_location=" + location_code + "&request_context=" + encodeURIComponent(JSON.stringify(request_context))).load();
swapDataTables(mms_id);
}

Expand Down
19 changes: 19 additions & 0 deletions app/assets/javascripts/expert_help.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$(document).ready(function() {
var $expert;
$expert = $('#ExpertOptions');

if (window.matchMedia("(min-width: 992px)").matches &&
!document.cookie.includes('franklin_hide_expert_help=true')) {
$expert.collapse('show');
} else {
$expert.collapse('hide');
}

$expert.on('hide.bs.collapse', function() {
document.cookie = 'franklin_hide_expert_help=true;path=/'
});

$expert.on('show.bs.collapse', function() {
document.cookie = 'franklin_hide_expert_help=;path=/;max-age=0'
});
});
2 changes: 1 addition & 1 deletion app/assets/javascripts/login-ezproxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 0 additions & 5 deletions app/assets/javascripts/no_db_results.js
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
$(document).ajaxComplete(function() {
if ($('.gs-no-results-result').length) {
$('#bento-results-google').addClass('hidden');
}
});
4 changes: 0 additions & 4 deletions app/assets/javascripts/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
*/
$(document).ready(function() {

$("#feedbackout").click(function(){
$("#feedback").hide();
});

$("a[role='tab']").bind('click', function(event) {
window.history.pushState({},"", $(event.currentTarget).attr("href"));
});
Expand Down
6 changes: 0 additions & 6 deletions app/assets/javascripts/two_columns.js

This file was deleted.

Loading

0 comments on commit a9a34cb

Please sign in to comment.