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

Bootstrap3 cart confirms and close fixes. The permenant close fix is temporary...

Bootstrap3 cart confirms and close fixes. The permenant close fix is temporary until jsobjects is implemented in 2.4.
parent 77e91a26
No related merge requests found
...@@ -171,8 +171,11 @@ function cartSubmit($form) { ...@@ -171,8 +171,11 @@ function cartSubmit($form) {
} else { } else {
Lightbox.displayError(vufindString['bulk_noitems_advice']); Lightbox.displayError(vufindString['bulk_noitems_advice']);
} }
} else { } else if ((submit != 'empty' || confirm(vufindString['confirmEmpty']))
&& (submit != 'delete' || confirm(vufindString['confirmDelete']))) {
Lightbox.submit($form, Lightbox.changeContent); Lightbox.submit($form, Lightbox.changeContent);
} else {
$('#modal').find('.fa.fa-spinner').remove();
} }
} }
...@@ -247,7 +250,7 @@ $(document).ready(function() { ...@@ -247,7 +250,7 @@ $(document).ready(function() {
}); });
return false; return false;
}); });
Lightbox.addCloseAction(function() { Lightbox.addPermenantCloseAction(function() {
// Update cart items (add to cart, remove from cart, cart lightbox interface) // Update cart items (add to cart, remove from cart, cart lightbox interface)
var cartCount = $('#cartItems strong'); var cartCount = $('#cartItems strong');
if(cartCount.length > 0) { if(cartCount.length > 0) {
......
...@@ -12,7 +12,8 @@ var Lightbox = { ...@@ -12,7 +12,8 @@ var Lightbox = {
shown: false, // Is the lightbox deployed? shown: false, // Is the lightbox deployed?
XHR: false, // Used for current in-progress XHR lightbox request XHR: false, // Used for current in-progress XHR lightbox request
openStack: [], // Array of functions to be called after changeContent or the lightbox event 'shown' openStack: [], // Array of functions to be called after changeContent or the lightbox event 'shown'
closeStack: [], // Array of functions to be called after the lightbox event 'hidden' closeStack: [], // Array of functions to be called and cleared after the lightbox event 'hidden'
closeStackPerm: [],// Array of functions to be called after the lightbox event 'hidden'
formHandlers: [], // Full custom handlers for forms; by name formHandlers: [], // Full custom handlers for forms; by name
formCallbacks: [], // Custom functions for forms, called after .submit(); by name formCallbacks: [], // Custom functions for forms, called after .submit(); by name
...@@ -44,6 +45,12 @@ var Lightbox = { ...@@ -44,6 +45,12 @@ var Lightbox = {
addCloseAction: function(func) { addCloseAction: function(func) {
this.closeStack.push(func); this.closeStack.push(func);
}, },
/**
* Register custom close event handlers
*/
addPermenantCloseAction: function(func) {
this.closeStackPerm.push(func);
},
/** /**
* For when you want to handle that form all by yourself * For when you want to handle that form all by yourself
* *
...@@ -127,6 +134,10 @@ var Lightbox = { ...@@ -127,6 +134,10 @@ var Lightbox = {
closeActions: function() { closeActions: function() {
Lightbox.shown = false; Lightbox.shown = false;
Lightbox.openingURL = false; Lightbox.openingURL = false;
// Permenant close actions
for(var i=Lightbox.closeStackPerm.length;i--;) {
Lightbox.closeStackPerm[i]();
}
// Clean out stack // Clean out stack
while(Lightbox.closeStack.length > 0) { while(Lightbox.closeStack.length > 0) {
var f = Lightbox.closeStack.pop(); var f = Lightbox.closeStack.pop();
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
$this->jsTranslations()->addStrings( $this->jsTranslations()->addStrings(
array( array(
'bulk_noitems_advice' => 'bulk_noitems_advice', 'bulk_noitems_advice' => 'bulk_noitems_advice',
'confirmDelete' => 'confirm_delete',
'confirmEmpty' => 'bookbag_confirm_empty', 'confirmEmpty' => 'bookbag_confirm_empty',
'viewBookBag' => 'View Book Bag', 'viewBookBag' => 'View Book Bag',
'addBookBag' => 'Add to Book Bag', 'addBookBag' => 'Add to Book Bag',
......
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