From: Olivier Lamy Date: Thu, 2 Feb 2012 20:42:50 +0000 (+0000) Subject: makes more sense to use a real selector here X-Git-Tag: archiva-1.4-M3~1397 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=88e5563d1dd134ad3d48aa65815ea208465fdcd5;p=archiva.git makes more sense to use a real selector here git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1239828 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js index 02da1b7c7..527823e8b 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js @@ -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"); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js index b7b28dbc6..1c3df7f2a 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js @@ -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"); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js index db41fac59..ccf12113b 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js @@ -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); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/register.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/register.js index 1dc6d6a8f..72c568424 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/register.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/register.js @@ -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) { diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js index 29cedc470..2a97aff5a 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js @@ -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); } }); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js index fa3b6c45e..1ae13a0fd 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js @@ -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") {