From 78b6a832079e303b9e478c98eb845d00abfaa578 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Fri, 8 Jul 2016 11:24:38 +0100 Subject: [PATCH 01/29] Bumped version number to v0.4.0 for any future features --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 6cfa984..9393b33 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ # version format -version: 0.3.0.{build} +version: 0.4.0.{build} # UMBRACO_PACKAGE_PRERELEASE_SUFFIX if a rtm release build this should be blank, otherwise if empty will default to alpha # example UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta From ae65aca244f0c82bc2d7a1ce74da9c8651cc7c64 Mon Sep 17 00:00:00 2001 From: Simone Chiaretta Date: Wed, 20 Jul 2016 10:19:28 +0200 Subject: [PATCH 02/29] Adding ~ to location of property editor and pre-value editor This way the url will always start from the root of the application, so working also when Umbraco is installed in subfolders --- .../PropertyEditors/NestedContentPropertyEditor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs b/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs index e1d33fa..6fe0805 100644 --- a/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs +++ b/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs @@ -15,7 +15,7 @@ namespace Our.Umbraco.NestedContent.PropertyEditors { - [PropertyEditor(NestedContentPropertyEditor.PropertyEditorAlias, "Nested Content", "/App_Plugins/NestedContent/Views/nestedcontent.html", ValueType = "JSON")] + [PropertyEditor(NestedContentPropertyEditor.PropertyEditorAlias, "Nested Content", "~/App_Plugins/NestedContent/Views/nestedcontent.html", ValueType = "JSON")] public class NestedContentPropertyEditor : PropertyEditor { internal const string ContentTypeAliasPropertyKey = "ncContentTypeAlias"; @@ -53,7 +53,7 @@ internal class NestedContentPreValueEditor : PreValueEditor { internal const string ContentTypesPreValueKey = "contentTypes"; - [PreValueField(ContentTypesPreValueKey, "Doc Types", "/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html", Description = "Select the doc types to use as the data blueprint.")] + [PreValueField(ContentTypesPreValueKey, "Doc Types", "~/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html", Description = "Select the doc types to use as the data blueprint.")] public string[] ContentTypes { get; set; } [PreValueField("minItems", "Min Items", "number", Description = "Set the minimum number of items allowed.")] From 90769aa4f9335d93e898b28704d137978172e412 Mon Sep 17 00:00:00 2001 From: Simone Chiaretta Date: Wed, 20 Jul 2016 10:23:34 +0200 Subject: [PATCH 03/29] Making view and resources start from "umbracoPath" Replaced the beginning of hard-coded urls with Umbraco.Sys.ServerVariables.umbracoSettings variables so that they always start from umbracoPath. --- .../UI/App_Plugins/NestedContent/Js/nestedcontent.directives.js | 2 +- .../UI/App_Plugins/NestedContent/Js/nestedcontent.resources.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.directives.js b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.directives.js index e70d238..ea2855e 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.directives.js +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.directives.js @@ -32,7 +32,7 @@ return { restrict: "E", replace: true, - templateUrl: "/App_Plugins/NestedContent/Views/nestedcontent.editor.html", + templateUrl: Umbraco.Sys.ServerVariables.umbracoSettings.appPluginsPath + "/NestedContent/Views/nestedcontent.editor.html", scope: { ngModel: '=', tabAlias: '=' diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.resources.js b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.resources.js index 192a501..d9a4edb 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.resources.js +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.resources.js @@ -2,7 +2,7 @@ function ($q, $http, umbRequestHelper) { return { getContentTypes: function () { - var url = "/umbraco/backoffice/NestedContent/NestedContentApi/GetContentTypes"; + var url = Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + "/backoffice/NestedContent/NestedContentApi/GetContentTypes"; return umbRequestHelper.resourcePromise( $http.get(url), 'Failed to retrieve content types' From 8040ae0814cd78199ea9272b72a3018c54056b0f Mon Sep 17 00:00:00 2001 From: Jeroen Breuer Date: Tue, 16 Aug 2016 11:33:16 +0200 Subject: [PATCH 04/29] Fix for #82. --- .../Converters/NestedContentValueConverter.cs | 2 +- .../Converters/SingleNestedContentValueConverter.cs | 2 +- .../Extensions/PublishedPropertyTypeExtensions.cs | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/Converters/NestedContentValueConverter.cs b/src/Our.Umbraco.NestedContent/Converters/NestedContentValueConverter.cs index 853781c..da536da 100644 --- a/src/Our.Umbraco.NestedContent/Converters/NestedContentValueConverter.cs +++ b/src/Our.Umbraco.NestedContent/Converters/NestedContentValueConverter.cs @@ -21,7 +21,7 @@ public override object ConvertDataToSource(PublishedPropertyType propertyType, o { try { - return propertyType.ConvertPropertyToNestedContent(source); + return propertyType.ConvertPropertyToNestedContent(source, preview); } catch (Exception e) { diff --git a/src/Our.Umbraco.NestedContent/Converters/SingleNestedContentValueConverter.cs b/src/Our.Umbraco.NestedContent/Converters/SingleNestedContentValueConverter.cs index 7dd66ee..9da1bd8 100644 --- a/src/Our.Umbraco.NestedContent/Converters/SingleNestedContentValueConverter.cs +++ b/src/Our.Umbraco.NestedContent/Converters/SingleNestedContentValueConverter.cs @@ -20,7 +20,7 @@ public override object ConvertDataToSource(PublishedPropertyType propertyType, o { try { - return propertyType.ConvertPropertyToNestedContent(source); + return propertyType.ConvertPropertyToNestedContent(source, preview); } catch (Exception e) { diff --git a/src/Our.Umbraco.NestedContent/Extensions/PublishedPropertyTypeExtensions.cs b/src/Our.Umbraco.NestedContent/Extensions/PublishedPropertyTypeExtensions.cs index 88694dd..3315eb0 100644 --- a/src/Our.Umbraco.NestedContent/Extensions/PublishedPropertyTypeExtensions.cs +++ b/src/Our.Umbraco.NestedContent/Extensions/PublishedPropertyTypeExtensions.cs @@ -36,7 +36,7 @@ public static bool IsSingleNestedContentProperty(this PublishedPropertyType publ int.TryParse(preValueDictionary["maxItems"], out maxItems) && maxItems == 1; } - public static object ConvertPropertyToNestedContent(this PublishedPropertyType propertyType, object source) + public static object ConvertPropertyToNestedContent(this PublishedPropertyType propertyType, object source, bool preview) { using (DisposableTimer.DebugDuration(string.Format("ConvertPropertyToNestedContent ({0})", propertyType.DataTypeId))) { @@ -78,7 +78,7 @@ public static object ConvertPropertyToNestedContent(this PublishedPropertyType p var propType = publishedContentType.GetPropertyType(jProp.Key); if (propType != null) { - properties.Add(new DetachedPublishedProperty(propType, jProp.Value)); + properties.Add(new DetachedPublishedProperty(propType, jProp.Value, preview)); } } @@ -98,7 +98,8 @@ public static object ConvertPropertyToNestedContent(this PublishedPropertyType p publishedContentType, properties.ToArray(), containerNode, - i)); + i, + preview)); } if (propertyType.IsSingleNestedContentProperty()) From 91d0c80df8313133d3ff938088db1e4ac1171bc3 Mon Sep 17 00:00:00 2001 From: Tom Pipe Date: Thu, 29 Sep 2016 18:38:06 +0100 Subject: [PATCH 05/29] Add feature to use {{index}} in a name template Added the ability to display the index position in a name template e.g "Column {{index}}" resulting in "Column 1, Column 2 etc" --- .../NestedContent/Js/nestedcontent.controllers.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js index c5dad75..15eb286 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js @@ -200,7 +200,15 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest var contentType = $scope.getContentTypeConfig($scope.model.value[idx].ncContentTypeAlias); if (contentType != null && contentType.nameExp) { - var newName = contentType.nameExp($scope.model.value[idx]); // Run it against the stored dictionary value, NOT the node object + var item = $scope.model.value[idx]; // Run it against the stored dictionary value, NOT the node object + + if (contentType.nameTemplate.indexOf("{{index}}") !== -1) { + var cloneItem = JSON.parse(JSON.stringify(item)); + cloneItem.index = (idx + 1); // inject the index position to the object + item = cloneItem; + } + + var newName = contentType.nameExp(item); if (newName && (newName = $.trim(newName))) { name = newName; } @@ -408,4 +416,4 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest }; } -]); \ No newline at end of file +]); From 69f09f646e85a2990d3e2b9a194403613f7f27ee Mon Sep 17 00:00:00 2001 From: Tom Pipe Date: Thu, 29 Sep 2016 18:43:28 +0100 Subject: [PATCH 06/29] Added documentation on the new {{index}} usage --- .../NestedContent/Views/nestedcontent.doctypepicker.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html index 5a42748..e756ae8 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html @@ -52,7 +52,7 @@

Name template:
- Enter an angular expression to evaluate against each item for its name. + Enter an angular expression to evaluate against each item for its name. Use {{index}} to display the item index

- \ No newline at end of file + From b04e55edaeee2311e23795c5b42256a6aec5255a Mon Sep 17 00:00:00 2001 From: leekelleher Date: Mon, 22 Aug 2016 19:04:57 +0100 Subject: [PATCH 07/29] Updated README + whitespace --- README.md | 2 +- build/package.proj | 2 +- .../Web/UI/App_Plugins/NestedContent/package.manifest | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b2a3050..efa4518 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Nested Content can be installed from either Our Umbraco or NuGet package reposit To install from Our Umbraco, please download the package from: -> [https://our.umbraco.org/projects/backoffice-extensions/nested-content](https://our.umbraco.org/projects/backoffice-extensions/nested-content) +> #### NuGet package repository diff --git a/build/package.proj b/build/package.proj index e30d6d4..af35a9a 100644 --- a/build/package.proj +++ b/build/package.proj @@ -31,7 +31,7 @@ Our.Umbraco.NestedContent Umbraco Nested Content - Copyright © 2015 Matt Brailsford, Lee Kelleher, Our Umbraco and other contributors + Copyright © 2015 Umbrella Inc, Our Umbraco and other contributors Matt Brailsford, Lee Kelleher https://our.umbraco.org/media/wiki/145710/635623752021571595_ncpng.png umbraco list editor diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest index 9e967b3..bcfcec0 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest @@ -4,7 +4,7 @@ '~/App_Plugins/NestedContent/Js/nestedcontent.directives.js', '~/App_Plugins/NestedContent/Js/nestedcontent.controllers.js' ], - "css" : [ - "~/App_Plugins/NestedContent/Css/nestedcontent.css" - ] + "css" : [ + "~/App_Plugins/NestedContent/Css/nestedcontent.css" + ] } \ No newline at end of file From fbbff9cdfb99163791c1948552d77ad71b002583 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 6 Oct 2016 11:39:54 +0100 Subject: [PATCH 08/29] Renamed the NuGet package for consistency across our other packages --- build/package.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package.proj b/build/package.proj index af35a9a..21da1f5 100644 --- a/build/package.proj +++ b/build/package.proj @@ -30,7 +30,7 @@ Our.Umbraco.NestedContent - Umbraco Nested Content + Nested Content for Umbraco Copyright © 2015 Umbrella Inc, Our Umbraco and other contributors Matt Brailsford, Lee Kelleher https://our.umbraco.org/media/wiki/145710/635623752021571595_ncpng.png From d5626a173ce2f4c6760bf118fee954b40bb11b8d Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 6 Oct 2016 11:40:20 +0100 Subject: [PATCH 09/29] Updated README Added "Dropdown List Multiple" to the list of Known Issues --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index efa4518..937ab8a 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ Please be aware that not all property-editors will work within Nested Content. T * Radiobutton List (default Umbraco core) * Repeatable Textstring (default Umbraco core) - this works in the back-office, but due to a bug in the value-converter it will produce additional blank entries * Upload (default Umbraco core) +* Dropdown List Multiple (default Umbraco core) --- From 915e057c36d3cad94e29d7bdc27cd5b675793074 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 6 Oct 2016 11:40:59 +0100 Subject: [PATCH 10/29] Updated LICENSE I wanted to explicitly state "MIT License" at the top --- LICENSE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LICENSE.md b/LICENSE.md index 6271e30..6cef29c 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,3 +1,5 @@ +The MIT License (MIT) + Copyright © 2014 Umbrella Inc, Our Umbraco and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of From f2465fdc1cbf369813bc3c9c75d016e88de2a06e Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 6 Oct 2016 11:44:15 +0100 Subject: [PATCH 11/29] Updated links to GitHub repo from "leekelleher" to "umco" --- README.md | 6 +++--- build/package.proj | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 937ab8a..3739934 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ If you prefer, you can compile Nested Content yourself, you'll need: To clone it locally click the "Clone in Windows" button above or run the following git commands. - git clone https://github.com/leekelleher/umbraco-nested-content.git umbraco-nested-content + git clone https://github.com/umco/umbraco-nested-content.git umbraco-nested-content cd umbraco-nested-content .\build.cmd @@ -81,7 +81,7 @@ Anyone and everyone is welcome to contribute. Please take a moment to review the Have a question? * [Nested Content Forum](https://our.umbraco.org/projects/backoffice-extensions/nested-content/nested-content-feedback) on Our Umbraco -* [Raise an issue](https://github.com/leekelleher/umbraco-nested-content/issues) on GitHub +* [Raise an issue](https://github.com/umco/umbraco-nested-content/issues) on GitHub ## Dev Team @@ -96,6 +96,6 @@ Have a question? ## License -Copyright © 2015 Umbrella Inc, Our Umbraco and [other contributors](https://github.com/leekelleher/umbraco-nested-content/graphs/contributors) +Copyright © 2015 Umbrella Inc, Our Umbraco and [other contributors](https://github.com/umco/umbraco-nested-content/graphs/contributors) Licensed under the [MIT License](LICENSE.md) diff --git a/build/package.proj b/build/package.proj index 21da1f5..c2de2cc 100644 --- a/build/package.proj +++ b/build/package.proj @@ -21,10 +21,10 @@ 7.1.4 Nested Content is a list editing property editor for Umbraco 7.1+ Matt Brailsford, Lee Kelleher - https://github.com/leekelleher/umbraco-nested-content/graphs/contributors + https://github.com/umco/umbraco-nested-content/graphs/contributors MIT license http://opensource.org/licenses/MIT - https://github.com/leekelleher/umbraco-nested-content + https://github.com/umco/umbraco-nested-content From beeec26b4f3d2686fb65d923c0815685dae8cde1 Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Wed, 19 Oct 2016 11:46:16 +0100 Subject: [PATCH 12/29] Had to roll back the appPath relative paths as they don't seem to resolve property in the prevalue editor (could be an umbraco version thing, but needs investigating) --- .../PropertyEditors/NestedContentPropertyEditor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs b/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs index 6fe0805..f03f648 100644 --- a/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs +++ b/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs @@ -15,7 +15,7 @@ namespace Our.Umbraco.NestedContent.PropertyEditors { - [PropertyEditor(NestedContentPropertyEditor.PropertyEditorAlias, "Nested Content", "~/App_Plugins/NestedContent/Views/nestedcontent.html", ValueType = "JSON")] + [PropertyEditor(NestedContentPropertyEditor.PropertyEditorAlias, "Nested Content", "/App_Plugins/NestedContent/Views/nestedcontent.html", ValueType = "JSON")] public class NestedContentPropertyEditor : PropertyEditor { internal const string ContentTypeAliasPropertyKey = "ncContentTypeAlias"; @@ -46,14 +46,14 @@ public NestedContentPropertyEditor() protected override PreValueEditor CreatePreValueEditor() { - return new NestedContentPreValueEditor(); + return new NestedContentPreValueEditor(); } internal class NestedContentPreValueEditor : PreValueEditor { internal const string ContentTypesPreValueKey = "contentTypes"; - [PreValueField(ContentTypesPreValueKey, "Doc Types", "~/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html", Description = "Select the doc types to use as the data blueprint.")] + [PreValueField(ContentTypesPreValueKey, "Doc Types", "/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html", Description = "Select the doc types to use as the data blueprint.")] public string[] ContentTypes { get; set; } [PreValueField("minItems", "Min Items", "number", Description = "Set the minimum number of items allowed.")] From e6140cd60c2c179e158a889d0180271eaccb2f38 Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Wed, 19 Oct 2016 11:47:17 +0100 Subject: [PATCH 13/29] Set to open automatically if max items is 1 and only 1 item in the list (also removed the icon and reoder icons) #85 --- .../NestedContent/Js/nestedcontent.controllers.js | 2 +- .../UI/App_Plugins/NestedContent/Views/nestedcontent.html | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js index c5dad75..08c0615 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js @@ -319,7 +319,7 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest } // If there is only one item, set it as current node - if ($scope.singleMode) { + if ($scope.singleMode || ($scope.nodes.length == 1 && $scope.maxItems == 1)) { $scope.currentNode = $scope.nodes[0]; } diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.html b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.html index 0943780..3d74db1 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.html +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.html @@ -12,10 +12,10 @@
- +
From fe46d588187512300bff92dcfc2a4ab3bd0c3181 Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Mon, 31 Oct 2016 07:46:41 +0000 Subject: [PATCH 14/29] Added ncNodeName filter into core codebase to allow people to get a nodes name from a picker as part of a label template --- .../NestedContent/Js/nestedcontent.filters.js | 46 +++++++++++++++++++ .../NestedContent/package.manifest | 3 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.filters.js diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.filters.js b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.filters.js new file mode 100644 index 0000000..39889c8 --- /dev/null +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.filters.js @@ -0,0 +1,46 @@ +// Filter to take a node id and grab it's name instead +// Usage: {{ pickerAlias | ncNodeName }} + +// Cache for node names so we don't make a ton of requests +var ncNodeNameCache = { + id: "", + keys: {} +} + +angular.module("umbraco.filters").filter("ncNodeName", function (editorState, entityResource) { + + return function (input) { + + // Check we have a value at all + if (input == "" || input.toString() == "0") + return ""; + + var currentNode = editorState.getCurrent(); + + // Ensure a unique cache per editor instance + var key = "ncNodeName_" + currentNode.key; + if (ncNodeNameCache.id != key) { + ncNodeNameCache.id = key; + ncNodeNameCache.keys = {}; + } + + // See if there is a value in the cache and use that + if (ncNodeNameCache.keys[input]) { + return ncNodeNameCache.keys[input]; + } + + // No value, so go fetch one + // We'll put a temp value in the cache though so we don't + // make a load of requests while we wait for a response + ncNodeNameCache.keys[input] = "Loading..."; + + entityResource.getById(input, "Document") + .then(function (ent) { + ncNodeNameCache.keys[input] = ent.name; + }); + + // Return the current value for now + return ncNodeNameCache.keys[input]; + } + +}); \ No newline at end of file diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest index bcfcec0..c6d3a07 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest @@ -1,5 +1,6 @@ { - "javascript" : [ + "javascript" : [, + '~/App_Plugins/NestedContent/Js/nestedcontent.filters.js' '~/App_Plugins/NestedContent/Js/nestedcontent.resources.js', '~/App_Plugins/NestedContent/Js/nestedcontent.directives.js', '~/App_Plugins/NestedContent/Js/nestedcontent.controllers.js' From e5322c6aa72c4240da6f8a5ae78f4e179a0a7220 Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Mon, 31 Oct 2016 11:18:47 +0000 Subject: [PATCH 15/29] Dropped the serialize/deserialize cloning in the getName method in favour of adding a temporary property and deleting it after name compilation. --- .../Js/nestedcontent.controllers.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js index fd3f3b0..75d540c 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js @@ -199,19 +199,21 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest var contentType = $scope.getContentTypeConfig($scope.model.value[idx].ncContentTypeAlias); - if (contentType != null && contentType.nameExp) { - var item = $scope.model.value[idx]; // Run it against the stored dictionary value, NOT the node object + if (contentType != null && contentType.nameExp) + { + // Run the expression against the stored dictionary value, NOT the node object + var item = $scope.model.value[idx]; - if (contentType.nameTemplate.indexOf("{{index}}") !== -1) { - var cloneItem = JSON.parse(JSON.stringify(item)); - cloneItem.index = (idx + 1); // inject the index position to the object - item = cloneItem; - } + // Add a temporary index property + item.index = (idx + 1); var newName = contentType.nameExp(item); if (newName && (newName = $.trim(newName))) { name = newName; } + + // Delete the index property as we don't want to persist it + delete item.index; } } From a2d7f8af132c88130fe0ab62fabfdf4a3b07117c Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Mon, 31 Oct 2016 11:25:12 +0000 Subject: [PATCH 16/29] Renamed 'index' param to '$index', just in case someone has a property named 'index' --- .../App_Plugins/NestedContent/Js/nestedcontent.controllers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js index 75d540c..a73b648 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js @@ -205,7 +205,7 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest var item = $scope.model.value[idx]; // Add a temporary index property - item.index = (idx + 1); + item['$index'] = (idx + 1); var newName = contentType.nameExp(item); if (newName && (newName = $.trim(newName))) { @@ -213,7 +213,7 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest } // Delete the index property as we don't want to persist it - delete item.index; + delete item['$index']; } } From 3856e930bed6bc20adbb946434c44e72c84012c4 Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Mon, 31 Oct 2016 11:59:50 +0000 Subject: [PATCH 17/29] Forgot to save project file with filters js file reference --- src/Our.Umbraco.NestedContent/Our.Umbraco.NestedContent.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Our.Umbraco.NestedContent/Our.Umbraco.NestedContent.csproj b/src/Our.Umbraco.NestedContent/Our.Umbraco.NestedContent.csproj index 1f75b5e..3006c60 100644 --- a/src/Our.Umbraco.NestedContent/Our.Umbraco.NestedContent.csproj +++ b/src/Our.Umbraco.NestedContent/Our.Umbraco.NestedContent.csproj @@ -243,6 +243,7 @@ + From 739070c1c02157212b875f3417b5b92e47eae7d8 Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Mon, 31 Oct 2016 12:01:40 +0000 Subject: [PATCH 18/29] Added dollar sign prefix to $index in guidlines in the prevalue editor --- .../NestedContent/Views/nestedcontent.doctypepicker.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html index e756ae8..3572a5e 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.doctypepicker.html @@ -52,7 +52,7 @@

Name template:
- Enter an angular expression to evaluate against each item for its name. Use {{index}} to display the item index + Enter an angular expression to evaluate against each item for its name. Use {{$index}} to display the item index

From d64692bc9aca21406c99e5dfde40f4783c79fa80 Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Mon, 31 Oct 2016 18:40:44 +0000 Subject: [PATCH 19/29] Fixes #70. I believe this is down to some property editors modifying config values when they should be treated as readonly. To get around this, we clone the model before binding it and then just sync the values back rather than the entire object. --- .../Js/nestedcontent.directives.js | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.directives.js b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.directives.js index ea2855e..01e3794 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.directives.js +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.directives.js @@ -2,25 +2,53 @@ function () { - var link = function ($scope, element, attrs, ctrl) { - $scope.nodeContext = $scope.model = $scope.ngModel; + var link = function ($scope) { - var tab = $scope.ngModel.tabs[0]; + // Clone the model because some property editors + // do weird things like updating and config values + // so we want to ensure we start from a fresh every + // time, we'll just sync the value back when we need to + $scope.model = angular.copy($scope.ngModel); + $scope.nodeContext = $scope.model; + + // Find the selected tab + var selectedTab = $scope.model.tabs[0]; if ($scope.tabAlias) { - angular.forEach($scope.ngModel.tabs, function (value, key) { - if (value.alias.toLowerCase() == $scope.tabAlias.toLowerCase()) { - tab = value; + angular.forEach($scope.model.tabs, function (tab) { + if (tab.alias.toLowerCase() == $scope.tabAlias.toLowerCase()) { + selectedTab = tab; return; } }); } - $scope.tab = tab; + $scope.tab = selectedTab; + // Listen for sync request var unsubscribe = $scope.$on("ncSyncVal", function (ev, args) { if (args.id === $scope.model.id) { + + // Tell inner controls we are submitting $scope.$broadcast("formSubmitting", { scope: $scope }); + + // Sync the values back + angular.forEach($scope.ngModel.tabs, function (tab) { + if (tab.alias.toLowerCase() == selectedTab.alias.toLowerCase()) { + + var localPropsMap = selectedTab.properties.reduce(function (map, obj) { + map[obj.alias] = obj; + return map; + }, {}); + + angular.forEach(tab.properties, function (prop) { + if (localPropsMap.hasOwnProperty(prop.alias)) { + prop.value = localPropsMap[prop.alias].value; + } + }); + + } + }); } }); @@ -54,7 +82,7 @@ // } // }); // } - + // return { // restrict: "E", // replace: true, From 706409c9bd41e7a078d74a1e0d6b21f230da9035 Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Tue, 1 Nov 2016 08:42:39 +0000 Subject: [PATCH 20/29] Fixed error in package manifest file --- .../Web/UI/App_Plugins/NestedContent/package.manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest index c6d3a07..b26653d 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest @@ -1,6 +1,6 @@ { "javascript" : [, - '~/App_Plugins/NestedContent/Js/nestedcontent.filters.js' + '~/App_Plugins/NestedContent/Js/nestedcontent.filters.js', '~/App_Plugins/NestedContent/Js/nestedcontent.resources.js', '~/App_Plugins/NestedContent/Js/nestedcontent.directives.js', '~/App_Plugins/NestedContent/Js/nestedcontent.controllers.js' From aab706019ca64912c27414cc7674d5d1b7173e89 Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Tue, 1 Nov 2016 09:24:24 +0000 Subject: [PATCH 21/29] Fixes #89 by calculating the overlay offset relative to page container instead of assuming it will always be a root level property editor --- .../Js/nestedcontent.controllers.js | 107 +++++++++++++----- .../NestedContent/Views/nestedcontent.html | 8 +- 2 files changed, 83 insertions(+), 32 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js index a73b648..05a07b1 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.controllers.js @@ -5,19 +5,19 @@ function ($scope, ncResources) { - $scope.add = function() { + $scope.add = function () { $scope.model.value.push({ - // As per PR #4, all stored content type aliases must be prefixed "nc" for easier recognition. - // For good measure we'll also prefix the tab alias "nc" - ncAlias: "", - ncTabAlias: "", - nameTemplate: "" - } + // As per PR #4, all stored content type aliases must be prefixed "nc" for easier recognition. + // For good measure we'll also prefix the tab alias "nc" + ncAlias: "", + ncTabAlias: "", + nameTemplate: "" + } ); } - $scope.selectedDocTypeTabs = function(cfg) { - var dt = _.find($scope.model.docTypes, function(itm) { + $scope.selectedDocTypeTabs = function (cfg) { + var dt = _.find($scope.model.docTypes, function (itm) { return itm.alias.toLowerCase() == cfg.ncAlias.toLowerCase(); }); var tabs = dt ? dt.tabs : []; @@ -53,11 +53,12 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest "$scope", "$interpolate", "$filter", + "$timeout", "contentResource", "localizationService", "Our.Umbraco.NestedContent.Resources.NestedContentResources", - function ($scope, $interpolate, $filter, contentResource, localizationService, ncResources) { + function ($scope, $interpolate, $filter, $timeout, contentResource, localizationService, ncResources) { //$scope.model.config.contentTypes; //$scope.model.config.minItems; @@ -152,17 +153,24 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest return; } - // calculate overlay position - // - yeah... it's jQuery (ungh!) but that's how the Grid does it. - var offset = $(event.target).offset(); - var scrollTop = $(event.target).closest(".umb-panel-body").scrollTop(); - if (offset.top < 400) { - $scope.overlayMenu.style.top = 300 + scrollTop; - } - else { - $scope.overlayMenu.style.top = offset.top - 150 + scrollTop; - } + // Position off screen till we are visible and can calculate offset + $scope.overlayMenu.style.top = -1000; + $scope.overlayMenu.style.left = -1000; + $scope.overlayMenu.show = true; + + $timeout(function () { + + var wrapper = $("#contentwrapper"); + var el = $("#nested-content--" + $scope.model.id + " .nested-content__node-type-picker .cell-tools-menu"); + + var offset = el.offsetRelative("#contentwrapper"); + + $scope.overlayMenu.style.top = (Math.round(wrapper.height() / 2) + offset.top) - Math.round(el.height() / 2); + $scope.overlayMenu.style.left = (Math.round(wrapper.width() / 2) + offset.left) - Math.round(el.width() / 2); + + }); + }; $scope.closeNodeTypePicker = function () { @@ -199,10 +207,9 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest var contentType = $scope.getContentTypeConfig($scope.model.value[idx].ncContentTypeAlias); - if (contentType != null && contentType.nameExp) - { + if (contentType != null && contentType.nameExp) { // Run the expression against the stored dictionary value, NOT the node object - var item = $scope.model.value[idx]; + var item = $scope.model.value[idx]; // Add a temporary index property item['$index'] = (idx + 1); @@ -274,9 +281,9 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest var scaffoldsLoaded = 0; $scope.scaffolds = []; _.each($scope.model.config.contentTypes, function (contentType) { - contentResource.getScaffold(-20, contentType.ncAlias).then(function(scaffold) { + contentResource.getScaffold(-20, contentType.ncAlias).then(function (scaffold) { // remove all tabs except the specified tab - var tab = _.find(scaffold.tabs, function(tab) { + var tab = _.find(scaffold.tabs, function (tab) { return tab.id != 0 && (tab.alias.toLowerCase() == contentType.ncTabAlias.toLowerCase() || contentType.ncTabAlias == ""); }); scaffold.tabs = []; @@ -289,19 +296,19 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest scaffoldsLoaded++; initIfAllScaffoldsHaveLoaded(); - }, function(error) { + }, function (error) { scaffoldsLoaded++; initIfAllScaffoldsHaveLoaded(); }); }); - var initIfAllScaffoldsHaveLoaded = function() { + var initIfAllScaffoldsHaveLoaded = function () { // Initialize when all scaffolds have loaded if ($scope.model.config.contentTypes.length == scaffoldsLoaded) { // Because we're loading the scaffolds async one at a time, we need to // sort them explicitly according to the sort order defined by the data type. var contentTypeAliases = []; - _.each($scope.model.config.contentTypes, function(contentType) { + _.each($scope.model.config.contentTypes, function (contentType) { contentTypeAliases.push(contentType.ncAlias); }); $scope.scaffolds = $filter('orderBy')($scope.scaffolds, function (s) { @@ -419,3 +426,47 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest } ]); + +// offsetRelative (or, if you prefer, positionRelative) +(function ($) { + + $.fn.offsetRelative = function (ancestor) { + var positionedAncestor = $(ancestor); + var object = $(this); + + var relativeOffset = { left: 0, top: 0 }; + + var leftSpacing = parseInt(object.css("margin-left")); + leftSpacing += parseInt(object.css("border-left-width")); + + var topSpacing = parseInt(object.css("margin-top")); + topSpacing += parseInt(object.css("border-top-width")); + + relativeOffset.left -= leftSpacing; + relativeOffset.top -= topSpacing; + + var offsetParent = object.offsetParent(); + + while (offsetParent[0] !== positionedAncestor[0] && !offsetParent.is('html')) { + var offsetParentPosition = offsetParent.position(); + + var offsetParentPositionLeft = offsetParentPosition.left; + var offsetParentPositionTop = offsetParentPosition.top; + + relativeOffset.top -= offsetParentPositionTop; + relativeOffset.left -= offsetParentPositionLeft; + + leftSpacing = parseInt(offsetParent.css("margin-left")); + leftSpacing += parseInt(offsetParent.css("border-left-width")); + topSpacing = parseInt(offsetParent.css("margin-top")); + topSpacing += parseInt(offsetParent.css("border-top-width")); + + relativeOffset.left -= leftSpacing; + relativeOffset.top -= topSpacing; + + offsetParent = offsetParent.offsetParent(); + } + return relativeOffset; + }; + +}(jQuery)); \ No newline at end of file diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.html b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.html index 3d74db1..0a98742 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.html +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Views/nestedcontent.html @@ -26,10 +26,10 @@
- +
- +
-
-
+
+
From 9a2fb327bdc4e65be8234524f7c980c80763909b Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 9 Nov 2016 10:03:55 +0000 Subject: [PATCH 22/29] Updated VS solution file version meta-data --- src/Our.Umbraco.NestedContent.sln | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Our.Umbraco.NestedContent.sln b/src/Our.Umbraco.NestedContent.sln index b00a091..013aa2f 100644 --- a/src/Our.Umbraco.NestedContent.sln +++ b/src/Our.Umbraco.NestedContent.sln @@ -1,7 +1,6 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{CEE9961C-D747-40CD-B0B2-868D6B46833E}" ProjectSection(SolutionItems) = preProject From 0a7e6e068891f06d52fe49e6b7e724dd05f14ccf Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 9 Nov 2016 10:13:38 +0000 Subject: [PATCH 23/29] AppVeyor - updated encrypted keys Updated the encrypted API keys for GitHub, NuGet and MyGet for the UMCO account. Removed the old MyGet specific feed for NestedContent; developers should be using the "umbraco-packages" one instead. --- appveyor.yml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9393b33..57d07e6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,22 +17,12 @@ artifacts: - path: artifacts\*.zip deploy: - # MyGet (Nested Content feed) Deployment for builds & releases - - provider: NuGet - server: https://www.myget.org/F/umbraco-nested-content/ - symbol_server: https://nuget.symbolsource.org/MyGet/umbraco-nested-content - api_key: - secure: Q1/4K8VSwr7BjwmKDTef8y5lOc7S+jK9ELuWy67y6OVRpjxmnF9M3Gfs1kT+ir8x - artifact: /.*\.nupkg/ - on: - branch: develop - - # MyGet (Umbraco Community feed) Deployment for builds & releases + # MyGet Deployment for builds & releases - provider: NuGet server: https://www.myget.org/F/umbraco-packages/ symbol_server: https://nuget.symbolsource.org/MyGet/umbraco-packages api_key: - secure: Q1/4K8VSwr7BjwmKDTef8y5lOc7S+jK9ELuWy67y6OVRpjxmnF9M3Gfs1kT+ir8x + secure: 36/Ax5O+e6wENlhoTwgvoEBZV3FG4XjF429SNTej2qsGTAL+cdfA1kT/tm1St8vx artifact: /.*\.nupkg/ on: branch: develop @@ -40,7 +30,7 @@ deploy: # GitHub Deployment for releases - provider: GitHub auth_token: - secure: pEozEGTqJutQwOidJU6BTB+Ix0NV4vrUnomhfeqheVz4RNwfxjEYLoqR4XabhlPz + secure: yDxrRTveSScJA35MQTOaLYVjoPKFKl2bHBkG+JMZjiN0r7AfuUCxVU3CgW8Imu4h artifact: /.*\.zip/ # upload all Zip packages to release assets draft: false prerelease: false @@ -52,7 +42,7 @@ deploy: - provider: NuGet server: api_key: - secure: CGzDKxw4QI/z2VSe9ceiYlIabqGXHolgBgVNWWZjVAJ2V5WLF11IFdlp9r5Qp+Sw + secure: eSLiOXbGVrxSG+X7PV6qTTUZ5VzS9EFj5+EufaWPfd+QXkF6gc8rZ4mGoHIVp/fL artifact: /.*\.nupkg/ on: branch: master From 34bfcfb4d0e23e3e7dabf94f584339c9bda9764b Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Wed, 30 Nov 2016 09:30:42 +0000 Subject: [PATCH 24/29] Removed rogue comma causing infinite loop in back office --- .../Web/UI/App_Plugins/NestedContent/package.manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest index b26653d..62fa763 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/package.manifest @@ -1,5 +1,5 @@ { - "javascript" : [, + "javascript" : [ '~/App_Plugins/NestedContent/Js/nestedcontent.filters.js', '~/App_Plugins/NestedContent/Js/nestedcontent.resources.js', '~/App_Plugins/NestedContent/Js/nestedcontent.directives.js', From 23060fc3846272638472c6aa149f65d603e71dce Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Wed, 30 Nov 2016 09:30:52 +0000 Subject: [PATCH 25/29] Removed unused using statements --- .../Web/Controllers/NestedContentApiController.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/Web/Controllers/NestedContentApiController.cs b/src/Our.Umbraco.NestedContent/Web/Controllers/NestedContentApiController.cs index dc7f109..3c234c6 100644 --- a/src/Our.Umbraco.NestedContent/Web/Controllers/NestedContentApiController.cs +++ b/src/Our.Umbraco.NestedContent/Web/Controllers/NestedContentApiController.cs @@ -1,10 +1,7 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using Our.Umbraco.NestedContent.Extensions; using Umbraco.Web.Editors; using Umbraco.Web.Mvc; -using System.Web.Http.ModelBinding; namespace Our.Umbraco.NestedContent.Web.Controllers { From 334cf1ede148e9d54a21de2d9467e635282dd762 Mon Sep 17 00:00:00 2001 From: mattbrailsford Date: Fri, 10 Mar 2017 14:42:16 +0000 Subject: [PATCH 26/29] Fixes #111 by wrapping nested ConvertDbToString and ConvertDbToEditor calls in a try catch --- .../NestedContentPropertyEditor.cs | 57 +++++++++++++------ 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs b/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs index f03f648..160a380 100644 --- a/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs +++ b/src/Our.Umbraco.NestedContent/PropertyEditors/NestedContentPropertyEditor.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.RegularExpressions; @@ -160,15 +161,26 @@ public override string ConvertDbToString(Property property, PropertyType propert } else { - // Create a fake property using the property abd stored value - var prop = new Property(propType, propValues[propKey] == null ? null : propValues[propKey].ToString()); + try + { + // Create a fake property using the property abd stored value + var prop = new Property(propType, propValues[propKey] == null ? null : propValues[propKey].ToString()); - // Lookup the property editor - var propEditor = PropertyEditorResolver.Current.GetByAlias(propType.PropertyEditorAlias); + // Lookup the property editor + var propEditor = PropertyEditorResolver.Current.GetByAlias(propType.PropertyEditorAlias); - // Get the editor to do it's conversion, and store it back - propValues[propKey] = propEditor.ValueEditor.ConvertDbToString(prop, propType, - ApplicationContext.Current.Services.DataTypeService); + // Get the editor to do it's conversion, and store it back + propValues[propKey] = propEditor.ValueEditor.ConvertDbToString(prop, propType, + ApplicationContext.Current.Services.DataTypeService); + } + catch (InvalidOperationException) + { + // https://github.com/umco/umbraco-nested-content/issues/111 + // Catch any invalid cast operations as likely means courier failed due to missing + // or trashed item so couldn't convert a guid back to an int + + propValues[propKey] = null; + } } } @@ -225,18 +237,29 @@ public override object ConvertDbToEditor(Property property, PropertyType propert } else { - // Create a fake property using the property abd stored value - var prop = new Property(propType, propValues[propKey] == null ? null : propValues[propKey].ToString()); + try + { + // Create a fake property using the property abd stored value + var prop = new Property(propType, propValues[propKey] == null ? null : propValues[propKey].ToString()); - // Lookup the property editor - var propEditor = PropertyEditorResolver.Current.GetByAlias(propType.PropertyEditorAlias); + // Lookup the property editor + var propEditor = PropertyEditorResolver.Current.GetByAlias(propType.PropertyEditorAlias); - // Get the editor to do it's conversion - var newValue = propEditor.ValueEditor.ConvertDbToEditor(prop, propType, - ApplicationContext.Current.Services.DataTypeService); + // Get the editor to do it's conversion + var newValue = propEditor.ValueEditor.ConvertDbToEditor(prop, propType, + ApplicationContext.Current.Services.DataTypeService); - // Store the value back - propValues[propKey] = (newValue == null) ? null : JToken.FromObject(newValue); + // Store the value back + propValues[propKey] = (newValue == null) ? null : JToken.FromObject(newValue); + } + catch (InvalidOperationException) + { + // https://github.com/umco/umbraco-nested-content/issues/111 + // Catch any invalid cast operations as likely means courier failed due to missing + // or trashed item so couldn't convert a guid back to an int + + propValues[propKey] = null; + } } } From 3c645db2a05d704ffe85aac8e81ec52422d35d46 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Sat, 18 Mar 2017 10:14:10 +0000 Subject: [PATCH 27/29] Updated README with Known Issues (added Tags property-editor) --- README.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3739934..17cf64c 100644 --- a/README.md +++ b/README.md @@ -55,15 +55,16 @@ A PDF download is also available: [Nested Content - Developers Guide v1.0.pdf](d ## Known Issues -Please be aware that not all property-editors will work within Nested Content. The following property-editors are known to have compatibility issues: - -* Checkbox List (default Umbraco core) -* Image Cropper (default Umbraco core) -* Macro Container (default Umbraco core) -* Radiobutton List (default Umbraco core) -* Repeatable Textstring (default Umbraco core) - this works in the back-office, but due to a bug in the value-converter it will produce additional blank entries -* Upload (default Umbraco core) -* Dropdown List Multiple (default Umbraco core) +Please be aware that not all property-editors will work within Nested Content. The following Umbraco core property-editors are known to have compatibility issues: + +* Checkbox List +* Dropdown List Multiple +* Image Cropper +* Macro Container +* Radiobutton List +* Repeatable Textstring - _this works in the back-office, but due to a bug in the value-converter it will produce additional blank entries_ +* Tags - _this appears to work, but by design it is intended to work once per page_ +* Upload --- From f0cdc1f765955957ab198f8cfa60f7d8f0d80611 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Sat, 18 Mar 2017 10:16:17 +0000 Subject: [PATCH 28/29] Updated README Corrected the AppVeyor CI build badge + link [skip ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 17cf64c..5cadb88 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Nested Content -[![Build status](https://img.shields.io/appveyor/ci/leekelleher/umbraco-nested-content.svg)](https://ci.appveyor.com/project/leekelleher/umbraco-nested-content) +[![Build status](https://img.shields.io/appveyor/ci/UMCO/umbraco-nested-content.svg)](https://ci.appveyor.com/project/UMCO/umbraco-nested-content) [![NuGet release](https://img.shields.io/nuget/v/Our.Umbraco.NestedContent.svg)](https://www.nuget.org/packages/Our.Umbraco.NestedContent) [![Our Umbraco project page](https://img.shields.io/badge/our-umbraco-orange.svg)](https://our.umbraco.org/projects/backoffice-extensions/nested-content) [![Chat on Gitter](https://img.shields.io/badge/gitter-join_chat-green.svg)](https://gitter.im/leekelleher/umbraco-nested-content) From b58aca219eb9359a6048237833c387211ed6a04b Mon Sep 17 00:00:00 2001 From: leekelleher Date: Sat, 18 Mar 2017 10:44:22 +0000 Subject: [PATCH 29/29] Updated developers-guide to include details about the new `{{$index}}` label template placeholder. --- docs/developers-guide.md | 8 ++++---- .../App_Plugins/NestedContent/Js/nestedcontent.filters.js | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/developers-guide.md b/docs/developers-guide.md index 9b4ca94..1b6d4f8 100644 --- a/docs/developers-guide.md +++ b/docs/developers-guide.md @@ -46,10 +46,10 @@ The prevalue editor allows you to configure the following properties. | Member | Type | Description | |-----------------|---------|-------------| -| Doc Types | List | Defines a list of doc types to use as data blue prints for this **Nested Content** instance. For each doc type you can provide the alias of the tab you wish to render (first tab is used by default if not set) as well as a template for generating list item labels using the syntax `{{propertyAlias}}`. | -| Min Items | Int | Sets the minimum number of items that should be allowed in the list. If greater than 0, **Nested Content** will pre-populate your list with the minimum amount of allowed items and prevent deleting items below this level. Defaults to 0. -| Max Itemd | Int | Sets the maximum number of items that should be allowed in the list. If greater than 0, **Nested Content** will prevent new items being added to the list above this threshold. Defaults to 0. | -| Confirm Deletes | Boolean | Enabling this will require item deletions to require a confirmation before being deleted. Defaults to TRUE | +| Doc Types | List | Defines a list of doc types to use as data blue prints for this **Nested Content** instance. For each doc type you can provide the alias of the tab you wish to render (first tab is used by default if not set) as well as a template for generating list item labels using the syntax `{{propertyAlias}}`. If you would like to include the index position in the label, you can use `{{$index}}`. | +| Min Items | Integer | Sets the minimum number of items that should be allowed in the list. If greater than `0`, **Nested Content** will pre-populate your list with the minimum amount of allowed items and prevent deleting items below this level. Defaults to `0`. +| Max Items | Integer | Sets the maximum number of items that should be allowed in the list. If greater than `0`, **Nested Content** will prevent new items being added to the list above this threshold. Defaults to `0`. | +| Confirm Deletes | Boolean | Enabling this will require item deletions to require a confirmation before being deleted. Defaults to `true`. | | Show Icons | Boolean | Enabling this will display the items doc type icon next to the name in the **Nested Content** list. | | Hide Label | Boolean | Enabling this will hide the property editors label and expand the **Nested Content** property editor to the full with of the editor window. | diff --git a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.filters.js b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.filters.js index 39889c8..cecd1fa 100644 --- a/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.filters.js +++ b/src/Our.Umbraco.NestedContent/Web/UI/App_Plugins/NestedContent/Js/nestedcontent.filters.js @@ -35,9 +35,9 @@ angular.module("umbraco.filters").filter("ncNodeName", function (editorState, en ncNodeNameCache.keys[input] = "Loading..."; entityResource.getById(input, "Document") - .then(function (ent) { - ncNodeNameCache.keys[input] = ent.name; - }); + .then(function (ent) { + ncNodeNameCache.keys[input] = ent.name; + }); // Return the current value for now return ncNodeNameCache.keys[input];