]> source.dussan.org Git - archiva.git/commitdiff
makes more sense to use a real selector here
authorOlivier Lamy <olamy@apache.org>
Thu, 2 Feb 2012 20:42:50 +0000 (20:42 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 2 Feb 2012 20:42:50 +0000 (20:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1239828 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js
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/register.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js

index 02da1b7c7230ea664ac98d3d5cf656505e409034..527823e8bc9e666d4331b945bef10136b34e864d 100644 (file)
@@ -256,7 +256,7 @@ $(function() {
        }
       }},
       showErrors: function(validator, errorMap, errorList) {
-       customShowError(validator,errorMap,errorMap);
+       customShowError("#main-content #network-proxy-edit-form",validator,errorMap,errorMap);
       }
     });
     validator.settings.messages["id"]=$.i18n.prop("id.required.or.alreadyexists");
index b7b28dbc6cfbad28763ea63260c0bc7dbb7d721a..1c3df7f2a9f148927560fc7376c8bdd59c83091d 100644 (file)
@@ -266,7 +266,7 @@ $(function() {
         }
       },
       showErrors: function(validator, errorMap, errorList) {
-        customShowError(validator,errorMap,errorMap);
+        customShowError("#main-content #managed-repository-edit-form",validator,errorMap,errorMap);
       }
     });
     validator.settings.messages["cronExpression"]=$.i18n.prop("cronExpression.notvalid");
@@ -693,7 +693,7 @@ $(function() {
         }
       },*/
       showErrors: function(validator, errorMap, errorList) {
-        customShowError(validator,errorMap,errorMap);
+        customShowError("#main-content #remote-repository-edit-form",validator,errorMap,errorMap);
       }
     });
     validator.settings.messages["cronExpression"]=$.i18n.prop("cronExpression.notvalid");
index db41fac59a0300c14e0e2297665937c7c6109798..ccf12113b8da7d238a539760ecb06d5207db99e7 100644 (file)
@@ -285,13 +285,14 @@ displayRestError=function(data,idToAppend){
 
 /**
  * used by validation error to customize error display in the ui
+ * @param selector
  * @param validator
  * @param errorMap
  * @param errorList
  */
-customShowError=function(formId, validator, errorMap, errorList) {
-  $( "#"+formId+" div.control-group" ).removeClass( "error" );
-  $( "#"+formId+" span.help-inline" ).remove();
+customShowError=function(selector, validator, errorMap, errorList) {
+  $( selector+" div.control-group" ).removeClass( "error" );
+  $( selector+" span.help-inline" ).remove();
   for ( var i = 0; errorList[i]; i++ ) {
     var error = errorList[i];
     var field = $("#"+error.element.id);
index 1dc6d6a8f4e4771f520893d15b9b16d207de1be6..72c5684246dccb282f22744018c82f7e437d65a5 100644 (file)
@@ -31,7 +31,7 @@ $(function() {
     window.modalRegisterWindow.modal('show');
     $("#user-register-form").validate({
       showErrors: function(validator, errorMap, errorList) {
-        customShowError("user-register-form",validator,errorMap,errorMap);
+        customShowError("#user-register-form",validator,errorMap,errorMap);
       }
     });
     $("#modal-register").delegate("#modal-register-ok", "click keydown keypress", function(e) {
index 29cedc470f1911323126939b513d13ae4357c802..2a97aff5a5040d45d217d3b6289125010207bddc 100644 (file)
@@ -300,7 +300,7 @@ $(function() {
         }
       },
       showErrors: function(validator, errorMap, errorList) {
-        customShowError("user-create",validator,errorMap,errorMap);
+        customShowError("#main-content #user-create",validator,errorMap,errorMap);
       }
 
     });
@@ -326,7 +326,7 @@ $(function() {
 
     $("#user-login-form").validate({
       showErrors: function(validator, errorMap, errorList) {
-        customShowError("user-login-form",validator,errorMap,errorMap);
+        customShowError("#user-login-form",validator,errorMap,errorMap);
       }
     });
     $("#modal-login").delegate("#modal-login-ok", "click keydown keypress", function(e) {
@@ -478,7 +478,7 @@ $(function() {
         }
       },
       showErrors: function(validator, errorMap, errorList) {
-        customShowError("password-change-form",validator,errorMap,errorMap);
+        customShowError("#password-change-form",validator,errorMap,errorMap);
       }
     });
 
@@ -528,7 +528,7 @@ $(function() {
         }
       },
       showErrors: function(validator, errorMap, errorList) {
-        customShowError("user-edit-form",validator,errorMap,errorMap);
+        customShowError("#user-edit-form",validator,errorMap,errorMap);
       }
     });
 
index fa3b6c45e09a4593f4d28ebeb6293e54593a62e1..1ae13a0fdbc8266545d9491c59d3f27ea51e381f 100644 (file)
@@ -21,7 +21,7 @@ $(function() {
   /**
    * view model used for users grid
    */
-  usersViewModel=function() {
+  UsersViewModel=function() {
     this.users = ko.observableArray([]);
     var self = this;
 
@@ -63,7 +63,7 @@ $(function() {
       $("#main-content #user-edit").remove();
       $('#main-content #user-create').show();
       ko.renderTemplate("redback/user-edit-tmpl", new User(), null, $("#createUserForm").get(0),"replaceChildren");
-      $("#main-content #createUserForm #user-create").delegate("#user-create-form-cancel-button", "click keydown", function(e) {
+      $("#main-content #createUserForm #user-create-form-cancel-button").on( "click", function(e) {
         e.preventDefault();
         activateUsersGridTab();
       });
@@ -74,7 +74,7 @@ $(function() {
           }
         },
         showErrors: function(validator, errorMap, errorList) {
-          customShowError("user-create",validator,errorMap,errorMap);
+          customShowError("#main-content #user-create",validator,errorMap,errorMap);
         }
       });
       $("#main-content #createUserForm #user-create").delegate("#user-create-form-register-button", "click keydown", function(e) {
@@ -121,7 +121,7 @@ $(function() {
 
       $("#main-content #users-view-tabs-li-user-edit a").html($.i18n.prop("edit"));
 
-      $("#main-content #user-create").delegate("#user-create-form-cancel-button", "click keydown", function(e) {
+      $("#main-content #user-create #user-create-form-cancel-button").on("click", function(e) {
         e.preventDefault();
         activateUsersGridTab();
       });
@@ -133,7 +133,7 @@ $(function() {
           }
         },
         showErrors: function(validator, errorMap, errorList) {
-          customShowError("user-create",validator,errorMap,errorMap);
+          customShowError("#main-content #user-create",validator,errorMap,errorMap);
         }
       });
       $("#main-content #user-create").delegate("#user-create-form-save-button", "click keydown", function(e) {
@@ -213,11 +213,11 @@ $(function() {
     screenChange();
     $("#main-content").html(mediumSpinnerImg());
     jQuery("#main-content").attr("data-bind",'template: {name:"usersGrid"}');
-    window.redbackModel.usersViewModel = new usersViewModel();
+    window.redbackModel.usersViewModel = new UsersViewModel();
     window.redbackModel.usersViewModel.loadUsers();
     ko.applyBindings(window.redbackModel.usersViewModel,jQuery("#main-content").get(0));
     $("#main-content").tab('show');//#users-view-tabs
-    $("#main-content a[data-toggle='tab']").on('show', function (e) {
+    $("#main-content #users-view-tabs a[data-toggle='tab']").on('show', function (e) {
       //$.log( $(e.target).attr("href") ); // activated tab
       //e.relatedTarget // previous tab
       if ($(e.target).attr("href")=="#createUserForm") {