change angular.lowercase() to .toLowerCase()

This commit is contained in:
Mads Rasmussen
2018-06-04 13:48:36 +02:00
parent fefb6e4454
commit 2b5ef7b45c
2 changed files with 19 additions and 19 deletions

View File

@@ -9,7 +9,7 @@ function booleanEditorController($scope, $rootScope, assetsService) {
$scope.renderModel.value = true;
}
if ($scope.model && $scope.model.value && ($scope.model.value.toString() === "1" || angular.lowercase($scope.model.value) === "true")) {
if ($scope.model && $scope.model.value && ($scope.model.value.toString() === "1" || $scope.model.value.toString().toLowerCase() === "true")) {
$scope.renderModel.value = true;
}
}

View File

@@ -12,42 +12,42 @@ function ColorPickerController($scope) {
$scope.model.useLabel = isTrue($scope.model.config.useLabel);
initActiveColor();
}
$scope.toggleItem = function (color) {
var currentColor = ($scope.model.value && $scope.model.value.hasOwnProperty("value"))
? $scope.model.value.value
: $scope.model.value;
var newColor;
var newColor;
if (currentColor === color.value) {
// deselect
$scope.model.value = $scope.model.useLabel ? { value: "", label: "" } : "";
newColor = "";
}
else {
// select
// select
$scope.model.value = $scope.model.useLabel ? { value: color.value, label: color.label } : color.value;
newColor = color.value;
newColor = color.value;
}
// this is required to re-validate
$scope.propertyForm.modelValue.$setViewValue(newColor);
};
// Method required by the valPropertyValidator directive (returns true if the property editor has at least one color selected)
// Method required by the valPropertyValidator directive (returns true if the property editor has at least one color selected)
$scope.validateMandatory = function () {
var isValid = !$scope.model.validation.mandatory || (
$scope.model.value != null
&& $scope.model.value != ""
&& (!$scope.model.value.hasOwnProperty("value") || $scope.model.value.value !== "")
);
return {
isValid: isValid,
errorMsg: "Value cannot be empty",
errorKey: "required"
};
}
);
return {
isValid: isValid,
errorMsg: "Value cannot be empty",
errorKey: "required"
};
}
$scope.isConfigured = $scope.model.config && $scope.model.config.items && _.keys($scope.model.config.items).length > 0;
// A color is active if it matches the value and label of the model.
@@ -124,8 +124,8 @@ function ColorPickerController($scope) {
// figures out if a value is trueish enough
function isTrue(bool) {
return !!bool && bool !== "0" && angular.lowercase(bool) !== "false";
}
}
angular.module("umbraco").controller("Umbraco.PropertyEditors.ColorPickerController", ColorPickerController);
return !!bool && bool !== "0" && bool.toString().toLowerCase() !== "false";
}
}
angular.module("umbraco").controller("Umbraco.PropertyEditors.ColorPickerController", ColorPickerController);