From d89b62421aa77aa3534a3773d70e58fb5a7aafb9 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Fri, 4 Dec 2015 10:06:17 -0500
Subject: [PATCH] Add link to list to end of bulk save cart action.

---
 languages/en.ini                                      |  1 +
 .../VuFind/src/VuFind/Controller/CartController.php   | 11 +++++++++--
 themes/bootstrap3/js/lightbox.js                      |  4 +++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/languages/en.ini b/languages/en.ini
index 506a169dc84..9e4ac655594 100644
--- a/languages/en.ini
+++ b/languages/en.ini
@@ -386,6 +386,7 @@ Go = "Go"
 Go to Standard View = "Go to Standard View"
 google_map_cluster = "Cluster"
 google_map_cluster_points = "Cluster Points"
+go_to_list = "Go To List"
 Grid = "Grid"
 Group = "Group"
 group_AND = "ALL Groups"
diff --git a/module/VuFind/src/VuFind/Controller/CartController.php b/module/VuFind/src/VuFind/Controller/CartController.php
index a4b48af277a..555440a412e 100644
--- a/module/VuFind/src/VuFind/Controller/CartController.php
+++ b/module/VuFind/src/VuFind/Controller/CartController.php
@@ -385,10 +385,17 @@ class CartController extends AbstractBase
         if ($this->formWasSubmitted('submit')) {
             $this->favorites()
                 ->saveBulk($this->getRequest()->getPost()->toArray(), $user);
-            $this->flashMessenger()->addMessage('bulk_save_success', 'success');
             $list = $this->params()->fromPost('list');
+            $listUrl = $this->url()->fromRoute('userList', ['id' => $list]);
+            $message = [
+                'html' => true,
+                'msg' => $this->translate('bulk_save_success') . '. '
+                . '<a href="' . $listUrl . '">'
+                . $this->translate('go_to_list') . '</a>.'
+            ];
+            $this->flashMessenger()->addMessage($message, 'success');
             if (!empty($list)) {
-                return $this->redirect()->toRoute('userList', ['id' => $list]);
+                return $listUrl;
             } else {
                 return $this->redirectToSource();
             }
diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js
index 829aa9d2eba..3085d266afd 100644
--- a/themes/bootstrap3/js/lightbox.js
+++ b/themes/bootstrap3/js/lightbox.js
@@ -442,8 +442,10 @@ $(document).ready(function() {
     location.reload();
   });
   Lightbox.addFormCallback('bulkSave', function(html) {
+    var listID = $('<div>'+html+'</div>').find('[name="listID"]');
+    var listUrl = VuFind.getPath() + '/MyResearch/MyList/'+listID.val();
     Lightbox.addCloseAction(refreshPageForLogin);
-    Lightbox.success(VuFind.translate('bulk_save_success'));
+    Lightbox.success(VuFind.translate('bulk_save_success') + '. <a href="'+listUrl+'">' + VuFind.translate('go_to_list') + '</a>.');
   });
   Lightbox.addFormCallback('bulkRecord', function(html) {
     Lightbox.close();
-- 
GitLab