Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Return false from ui.Confirmation callback will avoid closing the dia…

…log.
  • Loading branch information...
commit c18b882545efb8e66048a01d183759f5b5256183 1 parent c1737db
@hyphyphyph authored
Showing with 15 additions and 13 deletions.
  1. +10 −9 build/ui.js
  2. +5 −4 lib/components/confirmation/confirmation.js
View
19 build/ui.js
@@ -330,9 +330,9 @@ Dialog.prototype.hide = function(ms){
// hide / remove
this.el.addClass('hide');
if (this._effect) {
- setTimeout(function(self){
+ setTimeout(function(){
self.remove();
- }, 500, this);
+ }, 500);
} else {
self.remove();
}
@@ -448,7 +448,7 @@ Overlay.prototype.hide = function(){
exports.Confirmation = Confirmation;
/**
- * Return a new `Confirmation` dialog with the given
+ * Return a new `Confirmation` dialog with the given
* `title` and `msg`.
*
* @param {String} title or msg
@@ -562,15 +562,16 @@ Confirmation.prototype.render = function(options){
actions.find('.cancel').click(function(e){
e.preventDefault();
self.emit('cancel');
- self.callback(false);
+ self.callback(false)
self.hide();
});
actions.find('.ok').click(function(e){
e.preventDefault();
self.emit('ok');
- self.callback(true);
- self.hide();
+ if (self.callback(true) !== false) {
+ self.hide();
+ }
});
};
@@ -1148,9 +1149,9 @@ Notification.prototype.hide = function(ms){
// hide / remove
this.el.addClass('hide');
if (this._effect) {
- setTimeout(function(self){
+ setTimeout(function(){
self.remove();
- }, 500, this);
+ }, 500);
} else {
self.remove();
}
@@ -1297,7 +1298,7 @@ exports.Menu = Menu;
*/
exports.menu = function(){
- return new Menu();
+ return new Menu;
};
/**
View
9 lib/components/confirmation/confirmation.js
@@ -6,7 +6,7 @@
exports.Confirmation = Confirmation;
/**
- * Return a new `Confirmation` dialog with the given
+ * Return a new `Confirmation` dialog with the given
* `title` and `msg`.
*
* @param {String} title or msg
@@ -120,14 +120,15 @@ Confirmation.prototype.render = function(options){
actions.find('.cancel').click(function(e){
e.preventDefault();
self.emit('cancel');
- self.callback(false);
+ self.callback(false)
self.hide();
});
actions.find('.ok').click(function(e){
e.preventDefault();
self.emit('ok');
- self.callback(true);
- self.hide();
+ if (self.callback(true) !== false) {
+ self.hide();
+ }
});
};
Please sign in to comment.
Something went wrong with that request. Please try again.