Added hints for db usernames, similar to ftp usernames

This commit is contained in:
dmitry.malishev 2013-07-17 14:54:33 +03:00
commit 9aca19d773
5 changed files with 62 additions and 0 deletions

23
web/js/pages/edit.db.js Normal file
View file

@ -0,0 +1,23 @@
App.Actions.DB.update_db_username_hint = function(elm, hint) {
if (hint.trim() == '') {
$(elm).parent().find('.hint').html('');
}
if (hint.indexOf(GLOBAL.DB_USER_PREFIX) == 0) {
hint = hint.slice(GLOBAL.DB_USER_PREFIX.length, hint.length);
}
$(elm).parent().find('.hint').html(GLOBAL.DB_USER_PREFIX + hint);
}
App.Listeners.DB.keypress_db_username = function() {
$('input[name="v_dbuser"]').bind('keypress', function(evt) {
clearTimeout(window.frp_usr_tmt);
window.frp_usr_tmt = setTimeout(function() {
var elm = $(evt.target);
App.Actions.DB.update_db_username_hint(elm, $(elm).val());
}, 100);
});
}
//
// Page entry point
App.Listeners.DB.keypress_db_username();