diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js
index 642e4fb13b..1ba454ac65 100644
--- a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js
+++ b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js
@@ -57,7 +57,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
saveModel),
'Failed to save permissions');
},
-
+
getRecycleBin: function () {
return umbRequestHelper.resourcePromise(
@@ -424,7 +424,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
$http.get(
umbRequestHelper.getApiUrl(
"contentApiBaseUrl",
- "GetEmpty",
+ "GetEmpty",
[{ blueprintId: blueprintId }, { parentId: parentId}])),
'Failed to retrieve blueprint for id ' + blueprintId);
},
@@ -488,6 +488,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
getChildren: function (parentId, options) {
var defaults = {
+ includeProperties: [],
pageSize: 0,
pageNumber: 0,
filter: '',
@@ -531,6 +532,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
"GetChildren",
{
id: parentId,
+ includeProperties: _.pluck(options.includeProperties, 'alias').join(","),
pageNumber: options.pageNumber,
pageSize: options.pageSize,
orderBy: options.orderBy,
@@ -580,7 +582,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
"contentApiBaseUrl",
"GetDetailedPermissions", { contentId: contentId })),
'Failed to retrieve permissions for content item ' + contentId);
- },
+ },
getPermissions: function (nodeIds) {
return umbRequestHelper.resourcePromise(
@@ -741,11 +743,11 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
createBlueprintFromContent: function (contentId, name) {
return umbRequestHelper.resourcePromise(
- $http.post(
+ $http.post(
umbRequestHelper.getApiUrl("contentApiBaseUrl", "CreateBlueprintFromContent", {
contentId: contentId, name: name
- })
- ),
+ })
+ ),
"Failed to create blueprint from content with id " + contentId
);
}
diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs
index 64e3318b4c..26f938638c 100644
--- a/src/Umbraco.Web/Editors/ContentController.cs
+++ b/src/Umbraco.Web/Editors/ContentController.cs
@@ -389,7 +389,25 @@ namespace Umbraco.Web.Editors
Direction orderDirection = Direction.Ascending,
bool orderBySystemField = true,
string filter = "")
- {
+ {
+ return GetChildren(id, null, pageNumber, pageSize, orderBy, orderDirection, orderBySystemField, filter);
+ }
+
+ ///
+ /// Gets the children for the content id passed in
+ ///
+ ///
+ [FilterAllowedOutgoingContent(typeof(IEnumerable>), "Items")]
+ public PagedResult> GetChildren(
+ int id,
+ string includeProperties,
+ int pageNumber = 0, //TODO: This should be '1' as it's not the index
+ int pageSize = 0,
+ string orderBy = "SortOrder",
+ Direction orderDirection = Direction.Ascending,
+ bool orderBySystemField = true,
+ string filter = "")
+ {
long totalChildren;
IContent[] children;
if (pageNumber > 0 && pageSize > 0)
@@ -409,13 +427,17 @@ namespace Umbraco.Web.Editors
return new PagedResult>(0, 0, 0);
}
- // Note that we're excluding mapping of complex properties here to ensure that getting a larger amount of
- // children for listviews and other similar cases, will not make everything halt when it tries to deserialize a
- // complex property such as Nested Content.
var pagedResult = new PagedResult>(totalChildren, pageNumber, pageSize);
pagedResult.Items = children.Select(content =>
Mapper.Map>(content,
- opts => { opts.Items["ExcludeComplexProperties"] = true; }));
+ opts =>
+ {
+ // if there's a list of property aliases to map - we will make sure to store this in the mapping context.
+ if (String.IsNullOrWhiteSpace(includeProperties) == false)
+ {
+ opts.Items["IncludeProperties"] = includeProperties.Split(new[] { ", ", "," }, StringSplitOptions.RemoveEmptyEntries);
+ }
+ }));
return pagedResult;
}
diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs
index 89be6859d1..ccf22a8c34 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using AutoMapper;
using Umbraco.Core;
using Umbraco.Core.Logging;
@@ -30,7 +31,7 @@ namespace Umbraco.Web.Models.Mapping
/// Assigns the PropertyEditor, Id, Alias and Value to the property
///
///
- public T Convert(ResolutionContext context)
+ public virtual T Convert(ResolutionContext context)
{
var property = context.SourceValue as Property;
if (property == null)
@@ -55,19 +56,19 @@ namespace Umbraco.Web.Models.Mapping
Editor = editor.Alias
};
- // Complex properties such as Nested Content do not need to be mapped for simpler things like list views,
- // where they will not make sense to use anyways. To avoid having to do unnecessary mapping on large
- // collections of items in list views - we allow excluding mapping of certain properties.
- var excludeComplexProperties = false;
- if (context.Options.Items.ContainsKey("ExcludeComplexProperties"))
+ // if there's a set of property aliases specified, we will check if the current property's value should be mapped.
+ // if it isn't one of the ones specified in 'includeProperties', we will just return the result without mapping the Value.
+ if (context.Options.Items.ContainsKey("IncludeProperties"))
{
- excludeComplexProperties = System.Convert.ToBoolean(context.Options.Items["ExcludeComplexProperties"]);
+ var includeProperties = context.Options.Items["IncludeProperties"] as IEnumerable;
+ if (includeProperties != null && includeProperties.Contains(property.Alias) == false)
+ {
+ return result;
+ }
}
- if (excludeComplexProperties == false || ComplexPropertyTypeAliases.Contains(property.PropertyType.PropertyEditorAlias) == false)
- {
- result.Value = editor.ValueEditor.ConvertDbToEditor(property, property.PropertyType, DataTypeService);
- }
-
+
+ // if no 'IncludeProperties' were specified or this property is set to be included - we will map the value and return.
+ result.Value = editor.ValueEditor.ConvertDbToEditor(property, property.PropertyType, DataTypeService);
return result;
}
}
diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayConverter.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayConverter.cs
index 632268ab2f..86c79d9c59 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayConverter.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayConverter.cs
@@ -18,8 +18,7 @@ namespace Umbraco.Web.Models.Mapping
{
_textService = textService;
}
-
- public new ContentPropertyDisplay Convert(ResolutionContext context)
+ public override ContentPropertyDisplay Convert(ResolutionContext context)
{
var display = base.Convert(context);