]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1598] use bootstrap css 2.x . fix modal login
authorOlivier Lamy <olamy@apache.org>
Thu, 2 Feb 2012 20:40:45 +0000 (20:40 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 2 Feb 2012 20:40:45 +0000 (20:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1239817 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/login.html
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js

index 5f10b55f37cc803b5ee3bbf40797e1819a23d3d2..db41fac59a0300c14e0e2297665937c7c6109798 100644 (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>" );
   }
 }
index 5007d46fc7bc898f352b9bd9ae6d7f79088ae81c..0a706c8c0f164ef2bf67a2abac4507a04c638264 100644 (file)
 -->
 <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>
 
index d8af502c57120cf2d4d20c950cab8d13bb48ad67..c71f8f1a826a3a6c942bb2193faff7d06de42894 100644 (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();
+
   }
 
   /**