diff options
author | Olivier Lamy <olamy@apache.org> | 2012-12-23 00:00:19 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-12-23 00:00:19 +0000 |
commit | 9450b40445d60b9e85c33fd75c1e6b0df8fc3eb9 (patch) | |
tree | 87ea0674f881fe25aa2e1d8fafab880dd2affcb5 /archiva-modules | |
parent | faa30809eb4f2a747773391012221d2b4b18e1c0 (diff) | |
download | archiva-9450b40445d60b9e85c33fd75c1e6b0df8fc3eb9.tar.gz archiva-9450b40445d60b9e85c33fd75c1e6b0df8fc3eb9.zip |
reuse selector
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1425379 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js | 10 | ||||
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js | 16 |
2 files changed, 19 insertions, 7 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js index 377ff9a79..374bee46e 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js @@ -1409,12 +1409,13 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" } saveRedbackRuntimeConfiguration=function(){ - var valid = $("#main-content").find("#redback-runtime-general-form-id").valid(); + var mainContent=$("#main-content"); + var valid = mainContent.find("#redback-runtime-general-form-id").valid(); if (valid==false) { return; } $.log("saveRedbackRuntimeConfiguration"); - var saveButton = $("#redback-runtime-configuration-save" ); + var saveButton = mainContent.find("#redback-runtime-configuration-save" ); saveButton.button('loading'); clearUserMessages(); var userMessages=$("#user-messages"); @@ -1474,7 +1475,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" } activateRedbackRuntimeGeneralFormValidation=function(){ - var validator = $("#main-content" ).find("#redback-runtime-general-form-id").validate({ + var formSelector=$("#main-content" ).find("#redback-runtime-general-form-id"); + var validator = formSelector.validate({ rules: { usersCacheTimeToLiveSeconds : { digits: true, @@ -1488,7 +1490,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" } }, showErrors: function(validator, errorMap, errorList) { - customShowError("#main-content #redback-runtime-general-form-id",validator,errorMap,errorMap); + customShowError(formSelector,validator,errorMap,errorMap); } }); } 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 d42596eec..76963b69a 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 @@ -324,15 +324,25 @@ require(["jquery","jquery.tmpl","i18n","knockout"], function(jquery,jqueryTmpl,i removeValidationErrorMessages(selector); for ( var i = 0; errorList[i]; i++ ) { var error = errorList[i]; - var field = $(selector).find("#"+error.element.id); + if (typeof selector == 'string') { + var field = $(selector).find("#"+error.element.id); + } else { + var field = selector.find("#"+error.element.id); + } field.parents( "div.control-group" ).addClass( "error" ); field.parent().append( "<span class=\"help-inline\">" + error.message + "</span>" ); } } removeValidationErrorMessages=function(selector){ - $(selector).find("div.control-group" ).removeClass( "error" ); - $(selector).find("span.help-inline").remove(); + if (typeof selector == 'string') { + $(selector).find("div.control-group" ).removeClass( "error" ); + $(selector).find("span.help-inline").remove(); + } else { + selector.find("div.control-group" ).removeClass( "error" ); + selector.find("span.help-inline").remove(); + } + } appendArchivaVersion=function(){ |