mirror of https://github.com/apache/archiva.git
reuse selector
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1425379 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
faa30809eb
commit
9450b40445
|
@ -1409,12 +1409,13 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
}
|
}
|
||||||
|
|
||||||
saveRedbackRuntimeConfiguration=function(){
|
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) {
|
if (valid==false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$.log("saveRedbackRuntimeConfiguration");
|
$.log("saveRedbackRuntimeConfiguration");
|
||||||
var saveButton = $("#redback-runtime-configuration-save" );
|
var saveButton = mainContent.find("#redback-runtime-configuration-save" );
|
||||||
saveButton.button('loading');
|
saveButton.button('loading');
|
||||||
clearUserMessages();
|
clearUserMessages();
|
||||||
var userMessages=$("#user-messages");
|
var userMessages=$("#user-messages");
|
||||||
|
@ -1474,7 +1475,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
}
|
}
|
||||||
|
|
||||||
activateRedbackRuntimeGeneralFormValidation=function(){
|
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: {
|
rules: {
|
||||||
usersCacheTimeToLiveSeconds : {
|
usersCacheTimeToLiveSeconds : {
|
||||||
digits: true,
|
digits: true,
|
||||||
|
@ -1488,7 +1490,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showErrors: function(validator, errorMap, errorList) {
|
showErrors: function(validator, errorMap, errorList) {
|
||||||
customShowError("#main-content #redback-runtime-general-form-id",validator,errorMap,errorMap);
|
customShowError(formSelector,validator,errorMap,errorMap);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,15 +324,25 @@ require(["jquery","jquery.tmpl","i18n","knockout"], function(jquery,jqueryTmpl,i
|
||||||
removeValidationErrorMessages(selector);
|
removeValidationErrorMessages(selector);
|
||||||
for ( var i = 0; errorList[i]; i++ ) {
|
for ( var i = 0; errorList[i]; i++ ) {
|
||||||
var error = errorList[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.parents( "div.control-group" ).addClass( "error" );
|
||||||
field.parent().append( "<span class=\"help-inline\">" + error.message + "</span>" );
|
field.parent().append( "<span class=\"help-inline\">" + error.message + "</span>" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeValidationErrorMessages=function(selector){
|
removeValidationErrorMessages=function(selector){
|
||||||
$(selector).find("div.control-group" ).removeClass( "error" );
|
if (typeof selector == 'string') {
|
||||||
$(selector).find("span.help-inline").remove();
|
$(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(){
|
appendArchivaVersion=function(){
|
||||||
|
|
Loading…
Reference in New Issue