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

Make confirm->cancel lightbox closing more flexible when outside lightbox.

parent e4651a5a
Branches
Tags
No related merge requests found
...@@ -27,7 +27,6 @@ VuFind.register('lightbox', function Lightbox() { ...@@ -27,7 +27,6 @@ VuFind.register('lightbox', function Lightbox() {
} }
function _emit(msg, _details) { function _emit(msg, _details) {
var details = _details || {}; var details = _details || {};
// Fallback to document.createEvent() if creating a new CustomEvent fails (e.g. IE 11)
var event; var event;
try { try {
event = new CustomEvent(msg, { event = new CustomEvent(msg, {
...@@ -36,6 +35,7 @@ VuFind.register('lightbox', function Lightbox() { ...@@ -36,6 +35,7 @@ VuFind.register('lightbox', function Lightbox() {
cancelable: true cancelable: true
}); });
} catch (e) { } catch (e) {
// Fallback to document.createEvent() if creating a new CustomEvent fails (e.g. IE 11)
event = document.createEvent('CustomEvent'); event = document.createEvent('CustomEvent');
event.initCustomEvent(msg, true, true, details); event.initCustomEvent(msg, true, true, details);
} }
...@@ -284,6 +284,10 @@ VuFind.register('lightbox', function Lightbox() { ...@@ -284,6 +284,10 @@ VuFind.register('lightbox', function Lightbox() {
_clickedButton = null; _clickedButton = null;
var buttonData = { name: 'submit', value: 1 }; var buttonData = { name: 'submit', value: 1 };
if (submit.length > 0) { if (submit.length > 0) {
if (typeof submit.data('lightbox-close') !== 'undefined') {
close();
return false;
}
if (typeof submit.data('lightbox-ignore') !== 'undefined') { if (typeof submit.data('lightbox-ignore') !== 'undefined') {
return true; return true;
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<?=$this->flashmessages();?> <?=$this->flashmessages();?>
<div id="popupDetails" class="confirmDialog"> <div id="popupDetails" class="confirmDialog">
<form action="<?=$this->escapeHtmlAttr($this->confirm)?>" method="post"> <form class="pull-left" action="<?=$this->escapeHtmlAttr($this->confirm)?>" method="post">
<?php if (isset($this->extras)): ?> <?php if (isset($this->extras)): ?>
<?php foreach ($this->extras as $extra => $value): ?> <?php foreach ($this->extras as $extra => $value): ?>
<?php if (is_array($value)): ?> <?php if (is_array($value)): ?>
...@@ -18,7 +18,10 @@ ...@@ -18,7 +18,10 @@
<?php endforeach; ?> <?php endforeach; ?>
<?php endif;?> <?php endif;?>
<input class="btn btn-primary" type="submit" name="confirm" value="<?=$this->transEsc('confirm_dialog_yes') ?>" /> <input class="btn btn-primary" type="submit" name="confirm" value="<?=$this->transEsc('confirm_dialog_yes') ?>" />
<input class="btn btn-default" type="button" name="cancel" value="<?=$this->transEsc('confirm_dialog_no') ?>" onClick="VuFind.lightbox.close()" />
</form> </form>
<form class="pull-left" action="<?=$this->escapeHtmlAttr($this->cancel) ?>" method="post">
<input class="btn btn-default" data-lightbox-close type="submit" name="cancel" value="<?=$this->transEsc('confirm_dialog_no') ?>" />
</form>
<div class="clearfix"></div>
</div> </div>
</div> </div>
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