Skip to content
Snippets Groups Projects
Commit 8e12a61e authored by Ere Maijala's avatar Ere Maijala Committed by Chris Hallberg
Browse files

Emit VuFind.lightbox.login event even if processing is short-circuited (#1175)

parent 4381d464
No related merge requests found
...@@ -136,20 +136,19 @@ VuFind.register('lightbox', function Lightbox() { ...@@ -136,20 +136,19 @@ VuFind.register('lightbox', function Lightbox() {
_xhr = $.ajax(obj); _xhr = $.ajax(obj);
_xhr.always(function lbAjaxAlways() { _xhr = false; }) _xhr.always(function lbAjaxAlways() { _xhr = false; })
.done(function lbAjaxDone(content, status, jq_xhr) { .done(function lbAjaxDone(content, status, jq_xhr) {
if (jq_xhr.status === 205) { var errorMsgs = [];
VuFind.refreshPage(); if (jq_xhr.status !== 205) {
return; var testDiv = $('<div/>').html(content);
} errorMsgs = testDiv.find('.flash-message.alert-danger:not([data-lightbox-ignore])');
var testDiv = $('<div/>').html(content); // Place Hold error isolation
var errorMsgs = testDiv.find('.flash-message.alert-danger:not([data-lightbox-ignore])'); if (obj.url.match(/\/Record\/.*(Hold|Request)\?/)) {
// Place Hold error isolation if (errorMsgs.length && testDiv.find('.record').length) {
if (obj.url.match(/\/Record\/.*(Hold|Request)\?/)) { var msgs = errorMsgs.toArray().map(function getAlertHtml(el) {
if (errorMsgs.length && testDiv.find('.record').length) { return el.innerHTML;
var msgs = errorMsgs.toArray().map(function getAlertHtml(el) { }).join('<br/>');
return el.innerHTML; showAlert(msgs, 'danger');
}).join('<br/>'); return false;
showAlert(msgs, 'danger'); }
return false;
} }
} }
if ( // Close the lightbox after deliberate login if ( // Close the lightbox after deliberate login
...@@ -173,6 +172,10 @@ VuFind.register('lightbox', function Lightbox() { ...@@ -173,6 +172,10 @@ VuFind.register('lightbox', function Lightbox() {
} }
_currentUrl = _originalUrl; // Now that we're logged in, where were we? _currentUrl = _originalUrl; // Now that we're logged in, where were we?
} }
if (jq_xhr.status === 205) {
VuFind.refreshPage();
return;
}
render(content); render(content);
}) })
.fail(function lbAjaxFail(deferred, errorType, msg) { .fail(function lbAjaxFail(deferred, errorType, msg) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment