From f07e10b06fab1784201c10dcd2cb2890a0f6d331 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Thu, 10 Mar 2016 15:52:53 +0200
Subject: [PATCH] Added error handling to lightbox ajax load.

---
 themes/bootstrap3/js/lightbox.js                | 3 +++
 themes/bootstrap3/templates/layout/layout.phtml | 1 +
 2 files changed, 4 insertions(+)

diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js
index b5a95fb08ee..b5f567bab85 100644
--- a/themes/bootstrap3/js/lightbox.js
+++ b/themes/bootstrap3/js/lightbox.js
@@ -114,6 +114,9 @@ VuFind.lightbox = (function() {
           }
         }
         _update(html);
+      })
+      .fail(function() {
+        showAlert(VuFind.translate('error_occurred'), 'danger');  
       });
     return _xhr;
   };
diff --git a/themes/bootstrap3/templates/layout/layout.phtml b/themes/bootstrap3/templates/layout/layout.phtml
index 68531011374..25ab54c4eab 100644
--- a/themes/bootstrap3/templates/layout/layout.phtml
+++ b/themes/bootstrap3/templates/layout/layout.phtml
@@ -34,6 +34,7 @@
             'bulk_noitems_advice' => 'bulk_noitems_advice',
             'bulk_save_success' => 'bulk_save_success',
             'close' => 'close',
+            'error_occurred' => 'An error has occurred',
             'go_to_list' => 'go_to_list',
             'libphonenumber_invalid' => 'libphonenumber_invalid',
             'libphonenumber_invalidcountry' => 'libphonenumber_invalidcountry',
-- 
GitLab