mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-19 03:12:55 +09:00
Bug #3385: Close confirmation dialogs with the enter key
(cherry picked from commit 4f52867944)
This commit is contained in:
1 parent
8a1621ef7e
commit
7f672bd04f
2 files changed
+21
-2
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user