focus on username when opening login form

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1349198 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-06-12 08:56:22 +00:00
parent 7720351a50
commit d9a2049ab4
2 changed files with 17 additions and 7 deletions

View File

@ -309,8 +309,7 @@ define("utils",["jquery","i18n","jquery.tmpl"], function() {
* @param errorList
*/
customShowError=function(selector, validator, errorMap, errorList) {
$(selector).find("div.control-group" ).removeClass( "error" );
$(selector).find("span.help-inline").remove();
removeValidationErrorMessages(selector);
for ( var i = 0; errorList[i]; i++ ) {
var error = errorList[i];
var field = $(selector).find("#"+error.element.id);
@ -319,6 +318,11 @@ define("utils",["jquery","i18n","jquery.tmpl"], function() {
}
}
removeValidationErrorMessages=function(selector){
$(selector).find("div.control-group" ).removeClass( "error" );
$(selector).find("span.help-inline").remove();
}
appendArchivaVersion=function(){
return "_archivaVersion="+window.archivaRuntimeInfo.version;
}

View File

@ -326,12 +326,19 @@ define("redback.user",["jquery","order!utils","i18n","jquery.validate","order!kn
}
if (window.modalLoginWindow==null) {
window.modalLoginWindow = $("#modal-login").modal();
window.modalLoginWindow.bind('hidden', function () {
$("#modal-login-err-message").hide();
window.modalLoginWindow.on('hidden', function () {
$("#modal-login-err-message").html("");
removeValidationErrorMessages("#user-login-form");
});
// focus on user name
window.modalLoginWindow.on('shown', function (e) {
$("#user-login-form-username" ).focus();
})
}
$("#user-login-form").validate({
var userLoginForm = $("#user-login-form");
userLoginForm.validate({
showErrors: function(validator, errorMap, errorList) {
customShowError("#user-login-form",validator,errorMap,errorMap);
}
@ -347,10 +354,9 @@ define("redback.user",["jquery","order!utils","i18n","jquery.validate","order!kn
passwordReset();
});
}
/**
* callback success function on rest login call.
* modal close and hide/show some links (login,logout,register...)