mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
Bug #3385: Close confirmation dialogs with the enter key
This commit is contained in:
parent
d93f13297f
commit
4f52867944
@ -58,6 +58,15 @@ define(function(require) {
|
||||
}
|
||||
|
||||
function _setup(dialog) {
|
||||
$(dialog).keypress(function (e) {
|
||||
if (e.which == 13 || e.keyCode == 13) {
|
||||
$('#confirm_proceed', dialog).click();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// Submit action is configured in sunstone.js since it's an action_button
|
||||
return false;
|
||||
}
|
||||
|
@ -88,8 +88,18 @@ define(function(require) {
|
||||
function _setup(context) {
|
||||
var that = this;
|
||||
|
||||
$(context).keypress(function (e) {
|
||||
if (e.which == 13 || e.keyCode == 13) {
|
||||
$('#' + DIALOG_ID + 'Form', context).submit();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
$('#' + DIALOG_ID + 'Form', context).submit(function(e) {
|
||||
if (that.params.buttons != undefined){
|
||||
// With more than one button, skip
|
||||
if (that.params.buttons != undefined && that.params.buttons.length > 1){
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
@ -97,7 +107,7 @@ define(function(require) {
|
||||
Sunstone.getDialog(DIALOG_ID).hide();
|
||||
|
||||
if (that.params.submit != undefined){
|
||||
that.params.submit(this);
|
||||
that.params.submit[0](this);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user