forked from extern/egroupware
Bind key handler to save favorite on Enter
This commit is contained in:
parent
f561e7e7bf
commit
e9b5dfde4d
@ -452,7 +452,10 @@ var AppJS = Class.extend(
|
||||
}
|
||||
|
||||
var buttons = {};
|
||||
buttons[this.egw.lang("save")] = function() {
|
||||
buttons['save'] = {
|
||||
text: this.egw.lang('save'),
|
||||
default: true,
|
||||
click: function() {
|
||||
// Add a new favorite
|
||||
var name = $j("#name",this);
|
||||
|
||||
@ -528,6 +531,7 @@ var AppJS = Class.extend(
|
||||
$j("#filters",self.favorite_popup).empty();
|
||||
|
||||
$j(this).dialog("close");
|
||||
},
|
||||
};
|
||||
buttons[this.egw.lang("cancel")] = function() {
|
||||
if(typeof self.favorite_popup.group !== 'undefined' && self.favorite_popup.group.set_value)
|
||||
@ -545,6 +549,19 @@ var AppJS = Class.extend(
|
||||
}
|
||||
});
|
||||
|
||||
// Bind handler for enter keypress
|
||||
this.favorite_popup.off('keydown').on('keydown', jQuery.proxy(function(e) {
|
||||
var tagName = e.target.tagName.toLowerCase();
|
||||
tagName = (tagName === 'input' && e.target.type === 'button') ? 'button' : tagName;
|
||||
|
||||
if(e.keyCode == jQuery.ui.keyCode.ENTER && tagName !== 'textarea' && tagName !== 'select' && tagName !=='button')
|
||||
{
|
||||
e.preventDefault();
|
||||
$j('button[default]',this.favorite_popup.parent()).trigger('click');
|
||||
return false;
|
||||
}
|
||||
},this));
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user