From ee2ebc7d148e3b247583bf35cb96f57f6098c25a Mon Sep 17 00:00:00 2001 From: leekelleher Date: Fri, 7 Jun 2019 15:31:00 +0100 Subject: [PATCH] ReadOnlyValueController - enabled filters Previously the code checks if the `config` is an array, but with how config options are set, this would typically be an object (dictionary). So the previous code would never allow a filter to be set. Now the check is on the object property. --- .../readonlyvalue/readonlyvalue.controller.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/readonlyvalue/readonlyvalue.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/readonlyvalue/readonlyvalue.controller.js index 48ec95ba0e..a49ffeadaa 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/readonlyvalue/readonlyvalue.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/readonlyvalue/readonlyvalue.controller.js @@ -14,13 +14,7 @@ function ReadOnlyValueController($rootScope, $scope, $filter) { function formatDisplayValue() { - - if ($scope.model.config && - angular.isArray($scope.model.config) && - $scope.model.config.length > 0 && - $scope.model.config[0] && - $scope.model.config.filter) { - + if ($scope.model.config && $scope.model.config.filter) { if ($scope.model.config.format) { $scope.displayvalue = $filter($scope.model.config.filter)($scope.model.value, $scope.model.config.format); } else { @@ -29,12 +23,11 @@ function ReadOnlyValueController($rootScope, $scope, $filter) { } else { $scope.displayvalue = $scope.model.value; } - } //format the display value on init: formatDisplayValue(); - + $scope.$watch("model.value", function (newVal, oldVal) { //cannot just check for !newVal because it might be an empty string which we //want to look for. @@ -45,4 +38,4 @@ function ReadOnlyValueController($rootScope, $scope, $filter) { }); } -angular.module('umbraco').controller("Umbraco.PropertyEditors.ReadOnlyValueController", ReadOnlyValueController); \ No newline at end of file +angular.module('umbraco').controller("Umbraco.PropertyEditors.ReadOnlyValueController", ReadOnlyValueController);