diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/textstringnumber.html b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/textstringnumber.html new file mode 100644 index 0000000000..5409741ca5 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/textstringnumber.html @@ -0,0 +1,12 @@ +
+ + + Not a number + {{propertyForm.requiredField.errorMsg}} +
\ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js index 3bb909c717..5ab37fcb65 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js @@ -1,33 +1,36 @@ function textboxController($scope) { - // macro parameter editor doesn't contains a config object, - // so we create a new one to hold any properties + // so we create a new one to hold any properties if (!$scope.model.config) { $scope.model.config = {}; } if (!$scope.model.config.maxChars) { - $scope.model.config.maxChars = false; + $scope.model.config.maxChars = 500; } - $scope.model.maxlength = false; if ($scope.model.config && $scope.model.config.maxChars) { - $scope.model.maxlength = true; - if($scope.model.value == undefined) { + if ($scope.model.config.maxChars < 500) { + $scope.model.showcharacterslefttext = true; + } else { + $scope.model.showcharacterslefttext = false; + } + + if ($scope.model.value == undefined) { $scope.model.count = ($scope.model.config.maxChars * 1); } else { $scope.model.count = ($scope.model.config.maxChars * 1) - $scope.model.value.length; } } - $scope.model.change = function() { + $scope.model.change = function () { if ($scope.model.config && $scope.model.config.maxChars) { - if($scope.model.value == undefined) { + if ($scope.model.value == undefined) { $scope.model.count = ($scope.model.config.maxChars * 1); } else { $scope.model.count = ($scope.model.config.maxChars * 1) - $scope.model.value.length; } - if($scope.model.count < 0) { + if ($scope.model.count < 0) { $scope.model.value = $scope.model.value.substring(0, ($scope.model.config.maxChars * 1)); $scope.model.count = 0; } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html index d8c51ce9e0..c409048096 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.html @@ -4,11 +4,11 @@ val-server="value" ng-required="model.validation.mandatory" ng-trim="false" - ng-keyup="model.change()" /> + ng-keyup="model.change()" /> Required -
- {{model.count}} - characters left -
+
+ {{model.count}} + characters left +
\ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/TextboxPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/TextboxPropertyEditor.cs index bd07d503fa..d36e7a5ad5 100644 --- a/src/Umbraco.Web/PropertyEditors/TextboxPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/TextboxPropertyEditor.cs @@ -24,9 +24,8 @@ namespace Umbraco.Web.PropertyEditors internal class TextboxPreValueEditor : PreValueEditor { - [PreValueField("maxChars", "Maximum allowed characters", "number", Description = "If empty - no character limit")] + [PreValueField("maxChars", "Maximum allowed characters", "textstringnumber", Description = "If empty - 500 character limit")] public bool MaxChars { get; set; } - } - + } } -} +} \ No newline at end of file