From 40de02ca5d76da15fdabfd27b49ff8c0f363db9c Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 27 Oct 2014 16:11:20 +1000 Subject: [PATCH] working on U4-5687 Fix issues with mini content editor that is launched from new Edit button in MNTP --- .../contentpicker/contentpicker.controller.js | 2 ++ .../contentpicker/contentpicker.html | 2 +- .../ContentPickerPropertyEditor.cs | 30 ++++++++++++++++++- .../MultiNodeTreePickerPropertyEditor.cs | 6 +++- 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js index ccb5fa50f2..c06c2dce8d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js @@ -13,6 +13,7 @@ angular.module('umbraco') //configuration $scope.cfg = { multiPicker: "0", + showEditButton: "0", entityType: "Document", filterCssClass: "not-allowed not-published", @@ -29,6 +30,7 @@ angular.module('umbraco') //Umbraco persists boolean for prevalues as "0" or "1" so we need to convert that! $scope.cfg.multiPicker = ($scope.cfg.multiPicker === "0" ? false : true); + $scope.cfg.showEditButton = ($scope.cfg.showEditButton === "0" ? false : true); if ($scope.cfg.startNode.type === "member") { $scope.cfg.entityType = "Member"; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.html index 921b0a82ae..77aab51406 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.html @@ -15,7 +15,7 @@ {{node.name}} -
+
Edit
diff --git a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs index 115735fb92..d381efb9b2 100644 --- a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs @@ -1,4 +1,5 @@ -using Umbraco.Core; +using System.Collections.Generic; +using Umbraco.Core; using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors @@ -6,5 +7,32 @@ namespace Umbraco.Web.PropertyEditors [PropertyEditor(Constants.PropertyEditors.ContentPickerAlias, "Content Picker", "INT", "contentpicker", IsParameterEditor = true)] public class ContentPickerPropertyEditor : PropertyEditor { + + public ContentPickerPropertyEditor() + { + _internalPreValues = new Dictionary + { + {"showEditButton", "0"} + }; + } + + private IDictionary _internalPreValues; + public override IDictionary DefaultPreValues + { + get { return _internalPreValues; } + set { _internalPreValues = value; } + } + + protected override PreValueEditor CreatePreValueEditor() + { + return new ContentPickerPreValueEditor(); + } + + internal class ContentPickerPreValueEditor : PreValueEditor + { + [PreValueField("showEditButton", "Show edit button", "boolean")] + public string ShowEditButton { get; set; } + + } } } \ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs index 730395d35a..d23873406f 100644 --- a/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs @@ -16,7 +16,8 @@ namespace Umbraco.Web.PropertyEditors { _internalPreValues = new Dictionary { - {"multiPicker", "1"} + {"multiPicker", "1"}, + {"showEditButton", "0"} }; } @@ -46,6 +47,9 @@ namespace Umbraco.Web.PropertyEditors [PreValueField("maxNumber", "Maximum number of items", "number")] public string MaxNumber { get; set; } + [PreValueField("showEditButton", "Show edit button", "boolean")] + public string ShowEditButton { get; set; } + /// /// This ensures the multiPicker pre-val is set based on the maxNumber of nodes set ///