mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 04:12:46 +02:00
handle the enter button in domain server forms
This commit is contained in:
parent
ad48592a69
commit
a6c5f4308a
1 changed files with 19 additions and 1 deletions
|
@ -2,7 +2,9 @@ var Settings = {
|
||||||
showAdvanced: false,
|
showAdvanced: false,
|
||||||
ADVANCED_CLASS: 'advanced-setting',
|
ADVANCED_CLASS: 'advanced-setting',
|
||||||
DATA_ROW_CLASS: 'value-row',
|
DATA_ROW_CLASS: 'value-row',
|
||||||
DATA_COL_CLASS: 'value-col'
|
DATA_COL_CLASS: 'value-col',
|
||||||
|
ADD_ROW_BUTTON_CLASS: 'add-row',
|
||||||
|
TABLE_BUTTONS_CLASS: 'buttons'
|
||||||
};
|
};
|
||||||
|
|
||||||
var viewHelpers = {
|
var viewHelpers = {
|
||||||
|
@ -99,6 +101,22 @@ $(document).ready(function(){
|
||||||
$('#settings-form').on('click', '.del-row', function(){
|
$('#settings-form').on('click', '.del-row', function(){
|
||||||
deleteTableRow(this);
|
deleteTableRow(this);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$('#settings-form').on('keypress', 'table input', function(e){
|
||||||
|
if (e.keyCode == 13) {
|
||||||
|
// capture enter in table input
|
||||||
|
// if we have a sibling next to us that has an input, jump to it, otherwise check if we have a glyphicon for add to click
|
||||||
|
sibling = $(this).parent('td').next();
|
||||||
|
|
||||||
|
if (sibling.hasClass(Settings.DATA_COL_CLASS)) {
|
||||||
|
// jump to that input
|
||||||
|
sibling.find('input').focus()
|
||||||
|
} else if (sibling.hasClass(Settings.TABLE_BUTTONS_CLASS)) {
|
||||||
|
sibling.find('.' + Settings.ADD_ROW_BUTTON_CLASS).click()
|
||||||
|
$(this).blur()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('#settings-form').on('change', 'input.trigger-change', function(){
|
$('#settings-form').on('change', 'input.trigger-change', function(){
|
||||||
// this input was changed, add the changed data attribute to it
|
// this input was changed, add the changed data attribute to it
|
||||||
|
|
Loading…
Reference in a new issue