[MRM-1598] use bootstrap css 2.x . fix modal login

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1239817 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-02-02 20:40:45 +00:00
parent 14d506abd7
commit f7078be3dd
3 changed files with 19 additions and 21 deletions

View File

@ -289,13 +289,13 @@ displayRestError=function(data,idToAppend){
* @param errorMap
* @param errorList
*/
customShowError=function(validator, errorMap, errorList) {
$( "#main-content div.clearfix" ).removeClass( "error" );
$( "#main-content span.help-inline" ).remove();
customShowError=function(formId, validator, errorMap, errorList) {
$( "#"+formId+" div.control-group" ).removeClass( "error" );
$( "#"+formId+" span.help-inline" ).remove();
for ( var i = 0; errorList[i]; i++ ) {
var error = errorList[i];
var field = $("#"+error.element.id);
field.parents( "div.clearfix" ).addClass( "error" );
field.parents( "div.control-group" ).addClass( "error" );
field.parent().append( "<span class=\"help-inline\">" + error.message + "</span>" );
}
}

View File

@ -18,22 +18,22 @@
-->
<div id="modal-login" class="modal hide fade">
<div class="modal-header">
<a href="#" class="close">&times;</a>
<a href="#" class="close" data-dismiss="modal">&times;</a>
<h3>${$.i18n.prop('login.section.title')}</h3>
</div>
<div class="modal-body" id="modal-login-content">
<form id="user-login-form">
<div id="modal-login-err-message" class="alert-message error" style="display:none"></div>
<form id="user-login-form" class="form-horizontal">
<div id="modal-login-err-message" class="alert alert-error" style="display:none"></div>
<fieldset>
<div class="clearfix">
<label for="user-login-form-username">${$.i18n.prop('username')}</label>
<div class="input">
<div class="control-group">
<label class="control-label" for="user-login-form-username">${$.i18n.prop('username')}</label>
<div class="controls">
<input type="text" id="user-login-form-username" name="user-login-form-username" class="required" />
</div>
</div>
<div class="clearfix">
<label for="user-login-form-password">${$.i18n.prop('password')}</label>
<div class="input">
<div class="control-group">
<label class="control-label" for="user-login-form-password">${$.i18n.prop('password')}</label>
<div class="controls">
<input type="password" id="user-login-form-password" name="user-login-form-password" class="required" />
</div>
</div>
@ -41,7 +41,7 @@
</form>
</div>
<div class="modal-footer" id="modal-login-footer">
<button class="btn primary" onclick="return login();" id="modal-login-ok">${$.i18n.prop('login')}</button>
<button class="btn primary" id="modal-login-ok">${$.i18n.prop('login')}</button>
</div>
</div>

View File

@ -314,8 +314,10 @@ $(function() {
loginBox=function(){
screenChange();
if (window.modalLoginWindow!=null){
window.modalLoginWindow=null;
}
if (window.modalLoginWindow==null) {
$.log("window.modalLoginWindow==null");
window.modalLoginWindow = $("#modal-login").modal();
window.modalLoginWindow.bind('hidden', function () {
$("#modal-login-err-message").hide();
@ -324,18 +326,14 @@ $(function() {
$("#user-login-form").validate({
showErrors: function(validator, errorMap, errorList) {
customShowError(validator,errorMap,errorMap);
customShowError("user-login-form",validator,errorMap,errorMap);
}
});
$("#modal-login").delegate("#modal-login-ok", "click keydown keypress", function(e) {
e.preventDefault();
$.log("loginBox before login");
login();
});
$("#modal-login").show();
window.modalLoginWindow.modal('show');
$.log("window.modalLoginWindow= modal show");
$("#modal-login").focus();
}
/**