Fixes: U4-7660 [7.4 Fix] Added a default value to the Umbaco.TrueFalse datatype. Thanks Jeremy Pyne
This commit is contained in:
@@ -4,6 +4,11 @@ function booleanEditorController($scope, $rootScope, assetsService) {
|
||||
$scope.renderModel = {
|
||||
value: false
|
||||
};
|
||||
|
||||
if($scope.model.config.default.toString() === "1" && $scope.model && !$scope.model.value) {
|
||||
$scope.renderModel.value = true;
|
||||
}
|
||||
|
||||
if ($scope.model && $scope.model.value && ($scope.model.value.toString() === "1" || angular.lowercase($scope.model.value) === "true")) {
|
||||
$scope.renderModel.value = true;
|
||||
}
|
||||
@@ -14,7 +19,7 @@ function booleanEditorController($scope, $rootScope, assetsService) {
|
||||
$scope.$watch("renderModel.value", function (newVal) {
|
||||
$scope.model.value = newVal === true ? "1" : "0";
|
||||
});
|
||||
|
||||
|
||||
//here we declare a special method which will be called whenever the value has changed from the server
|
||||
//this is instead of doing a watch on the model.value = faster
|
||||
$scope.model.onValueChanged = function (newVal, oldVal) {
|
||||
@@ -23,4 +28,4 @@ function booleanEditorController($scope, $rootScope, assetsService) {
|
||||
};
|
||||
|
||||
}
|
||||
angular.module("umbraco").controller("Umbraco.PropertyEditors.BooleanController", booleanEditorController);
|
||||
angular.module("umbraco").controller("Umbraco.PropertyEditors.BooleanController", booleanEditorController);
|
||||
|
||||
Reference in New Issue
Block a user