diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js index 422f761851..123af3fc72 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js @@ -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; } } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/colorpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/colorpicker.controller.js index 5230f9ef2c..56ef917510 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/colorpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/colorpicker.controller.js @@ -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);