mirror of https://github.com/apache/archiva.git
minor cleanup on selector usage
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1298566 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b9a320a2da
commit
778b6cdbd7
|
@ -82,6 +82,10 @@ $(function() {
|
|||
var screen = $.urlParam('screen');
|
||||
|
||||
if(screen){
|
||||
if(screen=='network-proxies'&& hasKarma('archiva-manage-configuration')){
|
||||
displayNetworkProxies();
|
||||
return;
|
||||
}
|
||||
if(screen=='proxy-connectors'&& hasKarma('archiva-manage-configuration')){
|
||||
displayProxyConnectors();
|
||||
return;
|
||||
|
|
|
@ -270,7 +270,8 @@ $(function() {
|
|||
}
|
||||
|
||||
activateNetworkProxyFormValidation=function(){
|
||||
var validator = $("#main-content #network-proxy-edit-form").validate({
|
||||
var editForm=$("#main-content #network-proxy-edit-form");
|
||||
var validator = editForm.validate({
|
||||
rules: {id: {
|
||||
required: true,
|
||||
remote: {
|
||||
|
@ -279,7 +280,7 @@ $(function() {
|
|||
}
|
||||
}},
|
||||
showErrors: function(validator, errorMap, errorList) {
|
||||
customShowError("#main-content #network-proxy-edit-form",validator,errorMap,errorMap);
|
||||
customShowError(editForm,validator,errorMap,errorMap);
|
||||
}
|
||||
});
|
||||
validator.settings.messages["id"]=$.i18n.prop("id.required.or.alreadyexists");
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
<form id="network-proxy-edit-form" class="well form-horizontal">
|
||||
<fieldset id="network-proxy-edit-fieldset">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="id">${$.i18n.prop('id')}</label>
|
||||
<label class="control-label" for="id">${$.i18n.prop('id')}</label>
|
||||
<div class="controls">
|
||||
{{if update}}
|
||||
<span class="uneditable-input">${$data.networkProxy.id}</span>
|
||||
|
|
|
@ -285,11 +285,11 @@ displayRestError=function(data,idToAppend){
|
|||
* @param errorList
|
||||
*/
|
||||
customShowError=function(selector, validator, errorMap, errorList) {
|
||||
$.isFunction(selector)? selector.find("div.control-group" ).removeClass( "error" ):$(selector).find("div.control-group" ).removeClass( "error" );
|
||||
$.isFunction(selector)? selector.find("span.help-inline").remove():$(selector).find("span.help-inline").remove();
|
||||
$(selector).find("div.control-group" ).removeClass( "error" );
|
||||
$(selector).find("span.help-inline").remove();
|
||||
for ( var i = 0; errorList[i]; i++ ) {
|
||||
var error = errorList[i];
|
||||
var field = $("#"+error.element.id);
|
||||
var field = $(selector).find("#"+error.element.id);// $.isFunction(selector)? selector.find(fieldSelector ).get(0):$(selector).find(selector);
|
||||
field.parents( "div.control-group" ).addClass( "error" );
|
||||
field.parent().append( "<span class=\"help-inline\">" + error.message + "</span>" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue