Skip to content
Snippets Groups Projects
Commit f6fb865c authored by Chris Hallberg's avatar Chris Hallberg
Browse files

More complete list url in record save success messages.

parent f5fed138
Branches issue/20714
No related merge requests found
...@@ -281,7 +281,15 @@ class AbstractRecord extends AbstractBase ...@@ -281,7 +281,15 @@ class AbstractRecord extends AbstractBase
$driver->saveToFavorites($post, $user); $driver->saveToFavorites($post, $user);
// Display a success status message: // Display a success status message:
$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 . '" class="gotolist">'
. $this->translate('go_to_list') . '</a>.'
];
$this->flashMessenger()->addMessage($message, 'success');
// redirect to followup url saved in saveAction // redirect to followup url saved in saveAction
if ($url = $this->getFollowupUrl()) { if ($url = $this->getFollowupUrl()) {
......
...@@ -390,7 +390,7 @@ class CartController extends AbstractBase ...@@ -390,7 +390,7 @@ class CartController extends AbstractBase
$message = [ $message = [
'html' => true, 'html' => true,
'msg' => $this->translate('bulk_save_success') . '. ' 'msg' => $this->translate('bulk_save_success') . '. '
. '<a href="' . $listUrl . '">' . '<a href="' . $listUrl . '" class="gotolist">'
. $this->translate('go_to_list') . '</a>.' . $this->translate('go_to_list') . '</a>.'
]; ];
$this->flashMessenger()->addMessage($message, 'success'); $this->flashMessenger()->addMessage($message, 'success');
......
...@@ -405,6 +405,19 @@ var Lightbox = { ...@@ -405,6 +405,19 @@ var Lightbox = {
} }
}; };
function getListUrlFromHTML(html) {
var fakePage = $('<div>'+html+'</div>')
var listUrl = fakePage.find('a.gotolist').attr('href');
if (typeof listUrl === 'undefined') {
var listID = fakePage.find('[name="listID"]');
listUrl = VuFind.getPath() + '/MyResearch/MyList/'+listID.val();
}
var message = VuFind.translate('bulk_save_success');
if (listUrl) {
message += '. <a href="'+listUrl+'" class="gotolist">' + VuFind.translate('go_to_list') + '</a>.';
}
return message;
}
/** /**
* This is where you add click events to open the lightbox. * This is where you add click events to open the lightbox.
* We do it here so that non-JS users still have a good time. * We do it here so that non-JS users still have a good time.
...@@ -442,10 +455,10 @@ $(document).ready(function() { ...@@ -442,10 +455,10 @@ $(document).ready(function() {
location.reload(); location.reload();
}); });
Lightbox.addFormCallback('bulkSave', function(html) { 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.addCloseAction(refreshPageForLogin);
Lightbox.success(VuFind.translate('bulk_save_success') + '. <a href="'+listUrl+'">' + VuFind.translate('go_to_list') + '</a>.'); // go to list link
var msg = getListUrlFromHTML(html);
Lightbox.success(msg);
}); });
Lightbox.addFormCallback('bulkRecord', function(html) { Lightbox.addFormCallback('bulkRecord', function(html) {
Lightbox.close(); Lightbox.close();
......
...@@ -319,10 +319,12 @@ function recordDocReady() { ...@@ -319,10 +319,12 @@ function recordDocReady() {
Lightbox.addFormCallback('placeStorageRetrievalRequest', function() { Lightbox.addFormCallback('placeStorageRetrievalRequest', function() {
document.location.href = VuFind.getPath() + '/MyResearch/StorageRetrievalRequests'; document.location.href = VuFind.getPath() + '/MyResearch/StorageRetrievalRequests';
}); });
Lightbox.addFormCallback('saveRecord', function() { Lightbox.addFormCallback('saveRecord', function(html) {
checkSaveStatuses(); checkSaveStatuses();
refreshTagList(); refreshTagList();
Lightbox.confirm(VuFind.translate('bulk_save_success')); // go to list link
var msg = getListUrlFromHTML(html);
Lightbox.success(msg);
}); });
Lightbox.addFormCallback('smsRecord', function() { Lightbox.addFormCallback('smsRecord', function() {
Lightbox.confirm(VuFind.translate('sms_success')); Lightbox.confirm(VuFind.translate('sms_success'));
......
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