Merge pull request #744 from captainsafia/fix-dialog-button-layout

Fix button layout in dialog windows
This commit is contained in:
Min RK 2016-02-07 13:07:29 +01:00
commit 7117528dab
7 changed files with 39 additions and 30 deletions

View File

@ -184,8 +184,10 @@ define(function(require) {
var modal_obj = modal({
title: "Edit " + options.name + " Metadata",
body: dialogform,
default_button: "Cancel",
buttons: {
OK: { class : "btn-primary",
Cancel: {},
Edit: { class : "btn-primary",
click: function() {
/**
* validate json and set it
@ -200,8 +202,7 @@ define(function(require) {
}
options.callback(new_md);
}
},
Cancel: {}
}
},
notebook: options.notebook,
keyboard_manager: options.keyboard_manager,

View File

@ -72,7 +72,9 @@ define([
var d = dialog.modal({
title: "Rename File",
body: dialog_body,
default_button: "Cancel",
buttons : {
"Cancel": {},
"OK": {
class: "btn-primary",
click: function () {
@ -89,9 +91,8 @@ define([
);
return false;
}
},
"Cancel": {}
},
}
},
open : function () {
// Upon ENTER, click the OK button.
d.find('input[type="text"]').keydown(function (event) {

View File

@ -276,13 +276,13 @@ define([
title : 'Kernel not found',
body : body,
buttons : {
'Continue without kernel' : {
'Continue Without Kernel' : {
class : 'btn-danger',
click : function () {
that.events.trigger('no_kernel.Kernel');
}
},
OK : {
'Set Kernel' : {
class : 'btn-primary',
click : function () {
that.set_kernel(select.val());

View File

@ -1996,7 +1996,7 @@ define(function (require) {
'Are you sure you want to restart the current kernel and re-execute the whole notebook? All variables and outputs will be lost.'
),
buttons : {
"Restart & run all cells" : {
"Restart and Run All Cells" : {
"class" : "btn-danger",
"click" : function () {
that.execute_all_cells();
@ -2023,7 +2023,7 @@ define(function (require) {
'Do you want to restart the current kernel and clear all output? All variables and outputs will be lost.'
),
buttons : {
"Restart & clear all outputs" : {
"Restart and Clear All Outputs" : {
"class" : "btn-danger",
"click" : function (){
that.clear_all_output();
@ -2084,7 +2084,7 @@ define(function (require) {
options.dialog.keyboard_manager = this.keyboard_manager;
// add 'Continue running' cancel button
var buttons = {
"Continue running": {},
"Continue Running": {},
};
// hook up button.click actions after restart promise resolves
Object.keys(options.dialog.buttons).map(function (key) {
@ -2975,15 +2975,16 @@ define(function (require) {
keyboard_manager: this.keyboard_manager,
title : "Revert notebook to checkpoint",
body : body,
default_button: "Cancel",
buttons : {
Cancel: {},
Revert : {
class : "btn-danger",
click : function () {
that.restore_checkpoint(checkpoint.id);
}
},
Cancel : {}
}
}
});
};

View File

@ -176,14 +176,15 @@ define([
body : msg,
keyboard_manager: that.keyboard_manager,
notebook: that.notebook,
default_button: "Don't Restart",
buttons : {
"Try restarting now": {
"Don't Restart": {},
"Try Restarting Now": {
class: "btn-danger",
click: function () {
that.notebook.start_session();
}
},
"Don't restart": {}
}
}
});

View File

@ -82,8 +82,10 @@ define([
body: dialog_body,
notebook: options.notebook,
keyboard_manager: this.keyboard_manager,
default_button: "Cancel",
buttons : {
"OK": {
"Cancel": {},
"Rename": {
class: "btn-primary",
click: function () {
var new_name = d.find('input').val();
@ -108,9 +110,8 @@ define([
return false;
}
}
},
"Cancel": {}
},
}
},
open : function () {
/**
* Upon ENTER, click the OK button.

View File

@ -742,8 +742,10 @@ define([
var d = dialog.modal({
title : "Rename "+ item_type,
body : dialog_body,
default_button: "Cancel",
buttons : {
OK : {
Cancel: {},
Rename : {
class: "btn-primary",
click: function() {
that.contents.rename(item_path, utils.url_path_join(that.notebook_path, input.val())).then(function() {
@ -763,8 +765,7 @@ define([
console.warn('Error durring renaming :', e);
});
}
},
Cancel : {}
}
},
open : function () {
// Upon ENTER, click the OK button.
@ -861,7 +862,9 @@ define([
dialog.modal({
title : "Delete",
body : message,
default_button: "Cancel",
buttons : {
Cancel: {},
Delete : {
class: "btn-danger",
click: function() {
@ -889,8 +892,7 @@ define([
});
});
}
},
Cancel : {}
}
}
});
};
@ -906,7 +908,9 @@ define([
dialog.modal({
title : "Duplicate",
body : message,
default_button: "Cancel",
buttons : {
Cancel: {},
Duplicate : {
class: "btn-primary",
click: function() {
@ -929,8 +933,7 @@ define([
});
});
}
},
Cancel : {}
}
}
});
};
@ -1027,15 +1030,16 @@ define([
dialog.modal({
title : "Replace file",
body : 'There is already a file named ' + filename + ', do you want to replace it?',
default_button: "Cancel",
buttons : {
Cancel : {
click: function() { item.remove(); }
},
Overwrite : {
class: "btn-danger",
click: function () {
that.contents.save(path, model).then(on_success);
}
},
Cancel : {
click: function() { item.remove(); }
}
}
});