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 @@
-
+
-
+
@@ -42,8 +42,8 @@
-
-