From ccd438ba261a7970f534756e153e06843f53dd11 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 13 Nov 2014 18:06:58 +1100 Subject: [PATCH] Fixes: U4-5801 macro container property needs to be type TEXT --- .../macrocontainer/macrocontainer.controller.js | 13 ++++++++----- .../macrocontainer/macrocontainer.html | 14 +++++++------- .../MacroContainerPropertyEditor.cs | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.controller.js index 6dc3e41cd4..c3d3f91914 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.controller.js @@ -66,20 +66,23 @@ angular.module('umbraco') openDialog(index); }; - $scope.add =function(){ - openDialog(); + $scope.add = function () { + + if ($scope.model.config.max && $scope.model.config.max > 0 && $scope.renderModel.length >= $scope.model.config.max) { + //cannot add more than the max + return; + } + + openDialog(); }; $scope.remove =function(index){ $scope.renderModel.splice(index, 1); - $scope.macros.splice(index, 1); - $scope.model.value = trim($scope.macros.join(), ","); }; $scope.clear = function() { $scope.model.value = ""; $scope.renderModel = []; - $scope.macros = []; }; $scope.$on("formSubmitting", function (ev, args) { diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.html index 13adc94635..af3b82a257 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.html @@ -17,12 +17,12 @@ - \ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs index 6d24c9960d..b8f328f7fa 100644 --- a/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs @@ -9,7 +9,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.MacroContainerAlias, "Macro container", "macrocontainer")] + [PropertyEditor(Constants.PropertyEditors.MacroContainerAlias, "Macro container", "macrocontainer", ValueType = "TEXT")] public class MacroContainerPropertyEditor : PropertyEditor { ///