diff --git a/themes/bootstrap3/js/common.js b/themes/bootstrap3/js/common.js index 54b42de9d8c2b299ee508f47a7ebccde30fcce7f..c1245f2690b2a99165742e50d70eb44a5f56c9f2 100644 --- a/themes/bootstrap3/js/common.js +++ b/themes/bootstrap3/js/common.js @@ -41,6 +41,22 @@ var VuFind = (function VuFind() { return _translations[op] || op; }; + /** + * Reload the page without causing trouble with POST parameters while keeping hash + */ + var refreshPage = function refreshPage() { + var parts = window.location.href.split('#'); + if (typeof parts[1] === 'undefined') { + window.location.href = window.location.href; + } else { + var href = parts[0]; + // Force reload with a timestamp + href += href.indexOf('?') === -1 ? '?_=' : '&_='; + href += new Date().getTime() + '#' + parts[1]; + window.location.href = href; + } + } + //Reveal return { defaultSearchBackend: defaultSearchBackend, @@ -48,6 +64,7 @@ var VuFind = (function VuFind() { addTranslations: addTranslations, init: init, + refreshPage: refreshPage, register: register, translate: translate }; diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js index 2430797920de525a34afb906080da8861649573c..cf26313a7e650ac07ebf2c331d1168a5a319ba14 100644 --- a/themes/bootstrap3/js/lightbox.js +++ b/themes/bootstrap3/js/lightbox.js @@ -41,21 +41,6 @@ VuFind.register('lightbox', function Lightbox() { return document.dispatchEvent(event); } - /** - * Reload the page without causing trouble with POST parameters while keeping hash - */ - function _refreshPage() { - var parts = window.location.href.split('#'); - if (typeof parts[1] === 'undefined') { - window.location.href = window.location.href; - } else { - var href = parts[0]; - // Force reload with a timestamp - href += href.indexOf('?') === -1 ? '?_=' : '&_='; - href += new Date().getTime() + '#' + parts[1]; - window.location.href = href; - } - } // Public: Present an alert function showAlert(message, _type) { var type = _type || 'info'; @@ -140,7 +125,7 @@ VuFind.register('lightbox', function Lightbox() { _xhr.always(function lbAjaxAlways() { _xhr = false; }) .done(function lbAjaxDone(content, status, jq_xhr) { if (jq_xhr.status === 205) { - _refreshPage(); + VuFind.refreshPage(); return; } // Place Hold error isolation @@ -154,7 +139,7 @@ VuFind.register('lightbox', function Lightbox() { } if ( // Close the lightbox after deliberate login obj.method // is a form - && ((obj.url.match(/MyResearch/) && !obj.url.match(/Bulk/)) // that matches login/create account + && ((obj.url.match(/MyResearch/) && !obj.url.match(/Bulk/) && !obj.url.match(/Delete/)) // that matches login/create account || obj.url.match(/catalogLogin/)) // or catalog login for holds && $('<div/>').html(content).find('.flash-message.alert-danger').length === 0 // skip failed logins ) { @@ -164,7 +149,7 @@ VuFind.register('lightbox', function Lightbox() { }); if (_originalUrl.match(/UserLogin/) || obj.url.match(/catalogLogin/)) { if (eventResult) { - _refreshPage(); + VuFind.refreshPage(); } return false; } else { @@ -313,7 +298,7 @@ VuFind.register('lightbox', function Lightbox() { _modalBody = _modal.find('.modal-body'); _modal.on('hide.bs.modal', function lightboxHide() { if (VuFind.lightbox.refreshOnClose) { - _refreshPage(); + VuFind.refreshPage(); } _emit('VuFind.lightbox.closing'); }); diff --git a/themes/bootstrap3/templates/myresearch/delete.phtml b/themes/bootstrap3/templates/myresearch/delete.phtml index dc620723c239e377d0d36704c23932ef4974ecdc..6c138d756207ea36fa2e53f111e8fb4bf7ac43de 100644 --- a/themes/bootstrap3/templates/myresearch/delete.phtml +++ b/themes/bootstrap3/templates/myresearch/delete.phtml @@ -1,7 +1,7 @@ -<form action="<?=$this->url('myresearch-delete')?>" method="post" name="bulkDelete"> +<h2><?=$this->transEsc('delete_selected_favorites')?></h2> + <form action="<?=$this->url('myresearch-delete')?>" method="post" name="bulkDelete" data-lightbox-onclose="VuFind.refreshPage();"> <div id="popupMessages"><?=$this->flashmessages()?></div> <div id="popupDetails"> - <h2><?=$this->transEsc('delete_selected_favorites')?></h2> <? if (!$this->list): ?> <div class="alert alert-info"><?=$this->transEsc("fav_delete_warn") ?></div> <? else: ?>