From 91fff7a00d5d1db8fefd5c6460279c85d9840ac5 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Wed, 14 Sep 2016 14:18:58 -0400
Subject: [PATCH] Small improvements to lightbox.js

- Error messages now included in pop up.
- Pass form element to data-lightbox-onclose callback.
---
 themes/bootstrap3/js/lightbox.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js
index c09c436a436..abda91f7abd 100644
--- a/themes/bootstrap3/js/lightbox.js
+++ b/themes/bootstrap3/js/lightbox.js
@@ -164,8 +164,8 @@ VuFind.register('lightbox', function Lightbox() {
         }
         _update(content);
       })
-      .fail(function lbAjaxFail() {
-        showAlert(VuFind.translate('error_occurred'), 'danger');
+      .fail(function lbAjaxFail(deferred, errorType, msg) {
+        showAlert(VuFind.translate('error_occurred') + '<br/>' + msg, 'danger');
       });
     return _xhr;
   }
@@ -255,7 +255,7 @@ VuFind.register('lightbox', function Lightbox() {
     if ('string' === typeof $(form).data('lightboxOnclose')) {
       document.addEventListener('VuFind.lightbox.closed', function lightboxClosed(e) {
         this.removeEventListener('VuFind.lightbox.closed', arguments.callee);
-        _evalCallback($(form).data('lightboxOnclose'), e);
+        _evalCallback($(form).data('lightboxOnclose'), e, form);
       }, false);
     }
     // Loading
-- 
GitLab