avoid breaking change of serverValidationManager.subscribe()
This commit is contained in:
+2
-2
@@ -117,10 +117,10 @@
|
||||
});
|
||||
|
||||
angular.forEach(scope.content.variants, function (variant) {
|
||||
unsubscribe.push(serverValidationManager.subscribe(null, variant.language !== null ? variant.language.culture : null, variant.segment, null, onVariantValidation));
|
||||
unsubscribe.push(serverValidationManager.subscribe(null, variant.language !== null ? variant.language.culture : null, null, onVariantValidation, variant.segment));
|
||||
});
|
||||
|
||||
unsubscribe.push(serverValidationManager.subscribe(null, null, null, null, onVariantValidation));
|
||||
unsubscribe.push(serverValidationManager.subscribe(null, null, null, onVariantValidation, null));
|
||||
|
||||
|
||||
|
||||
|
||||
+22
-17
@@ -222,26 +222,31 @@ function valPropertyMsg(serverValidationManager, localizationService) {
|
||||
// the correct field validation in their property editors.
|
||||
|
||||
if (scope.currentProperty) { //this can be null if no property was assigned
|
||||
|
||||
function serverValidationManagerCallback(isValid, propertyErrors, allErrors) {
|
||||
hasError = !isValid;
|
||||
if (hasError) {
|
||||
//set the error message to the server message
|
||||
scope.errorMsg = propertyErrors[0].errorMsg;
|
||||
//flag that the current validator is invalid
|
||||
formCtrl.$setValidity('valPropertyMsg', false);
|
||||
startWatch();
|
||||
}
|
||||
else {
|
||||
scope.errorMsg = "";
|
||||
//flag that the current validator is valid
|
||||
formCtrl.$setValidity('valPropertyMsg', true);
|
||||
stopWatch();
|
||||
}
|
||||
}
|
||||
|
||||
unsubscribe.push(serverValidationManager.subscribe(scope.currentProperty.alias,
|
||||
currentCulture,
|
||||
currentSegment,
|
||||
"",
|
||||
function(isValid, propertyErrors, allErrors) {
|
||||
hasError = !isValid;
|
||||
if (hasError) {
|
||||
//set the error message to the server message
|
||||
scope.errorMsg = propertyErrors[0].errorMsg;
|
||||
//flag that the current validator is invalid
|
||||
formCtrl.$setValidity('valPropertyMsg', false);
|
||||
startWatch();
|
||||
}
|
||||
else {
|
||||
scope.errorMsg = "";
|
||||
//flag that the current validator is valid
|
||||
formCtrl.$setValidity('valPropertyMsg', true);
|
||||
stopWatch();
|
||||
}
|
||||
}));
|
||||
serverValidationManagerCallback,
|
||||
currentSegment
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -91,24 +91,26 @@ function valServer(serverValidationManager) {
|
||||
}
|
||||
|
||||
//subscribe to the server validation changes
|
||||
function serverValidationManagerCallback(isValid, propertyErrors, allErrors) {
|
||||
if (!isValid) {
|
||||
modelCtrl.$setValidity('valServer', false);
|
||||
//assign an error msg property to the current validator
|
||||
modelCtrl.errorMsg = propertyErrors[0].errorMsg;
|
||||
startWatch();
|
||||
}
|
||||
else {
|
||||
modelCtrl.$setValidity('valServer', true);
|
||||
//reset the error message
|
||||
modelCtrl.errorMsg = "";
|
||||
stopWatch();
|
||||
}
|
||||
}
|
||||
unsubscribe.push(serverValidationManager.subscribe(currentProperty.alias,
|
||||
currentCulture,
|
||||
currentSegment,
|
||||
fieldName,
|
||||
function(isValid, propertyErrors, allErrors) {
|
||||
if (!isValid) {
|
||||
modelCtrl.$setValidity('valServer', false);
|
||||
//assign an error msg property to the current validator
|
||||
modelCtrl.errorMsg = propertyErrors[0].errorMsg;
|
||||
startWatch();
|
||||
}
|
||||
else {
|
||||
modelCtrl.$setValidity('valServer', true);
|
||||
//reset the error message
|
||||
modelCtrl.errorMsg = "";
|
||||
stopWatch();
|
||||
}
|
||||
}));
|
||||
serverValidationManagerCallback,
|
||||
currentSegment)
|
||||
);
|
||||
|
||||
scope.$on('$destroy', function () {
|
||||
stopWatch();
|
||||
|
||||
@@ -35,7 +35,6 @@ function valServerField(serverValidationManager) {
|
||||
|
||||
//subscribe to the server validation changes
|
||||
unsubscribe.push(serverValidationManager.subscribe(null,
|
||||
null,
|
||||
null,
|
||||
fieldName,
|
||||
function(isValid, fieldErrors, allErrors) {
|
||||
|
||||
@@ -158,7 +158,7 @@ function serverValidationManager($timeout) {
|
||||
* field alias to listen for.
|
||||
* If propertyAlias is null, then this subscription is for a field property (not a user defined property).
|
||||
*/
|
||||
subscribe: function (propertyAlias, culture, segment, fieldName, callback) {
|
||||
subscribe: function (propertyAlias, culture, fieldName, callback, segment) {
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user