Merge branch 'u4-5123' of https://github.com/AndyButland/Umbraco-CMS into AndyButland-u4-5123

# Conflicts:
#	src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs
This commit is contained in:
Mads Rasmussen
2016-02-18 10:00:22 +01:00
3 changed files with 35 additions and 10 deletions

View File

@@ -60,6 +60,7 @@ function listViewController($rootScope, $scope, $routeParams, $injector, $cookie
};
$scope.options = {
displayAtTabNumber: $scope.model.config.displayAtTabNumber ? $scope.model.config.displayAtTabNumber : 1,
pageSize: $scope.model.config.pageSize ? $scope.model.config.pageSize : 10,
pageNumber: ($routeParams.page && Number($routeParams.page) != NaN && Number($routeParams.page) > 0) ? $routeParams.page : 1,
filter: '',

View File

@@ -114,9 +114,6 @@ namespace Umbraco.Web.Models.Mapping
//re-assign
genericProps.Properties = contentProps;
}
/// <summary>
@@ -187,12 +184,38 @@ namespace Umbraco.Web.Models.Mapping
});
listViewTab.Properties = listViewProperties;
//Is there a better way?
var tabs = new List<Tab<ContentPropertyDisplay>>();
tabs.Add(listViewTab);
tabs.AddRange(display.Tabs);
display.Tabs = tabs;
SetChildItemsTabPosition(display, listViewConfig, listViewTab);
}
private static void SetChildItemsTabPosition<TPersisted>(TabbedContentItem<ContentPropertyDisplay, TPersisted> display,
IDictionary<string, object> listViewConfig,
Tab<ContentPropertyDisplay> listViewTab)
where TPersisted : IContentBase
{
// Find position of tab from config
var tabIndexForChildItems = 0;
if (listViewConfig["displayAtTabNumber"] != null && int.TryParse((string)listViewConfig["displayAtTabNumber"], out tabIndexForChildItems))
{
// Tab position is recorded 1-based but we insert into collection 0-based
tabIndexForChildItems--;
// Ensure within bounds
if (tabIndexForChildItems < 0)
{
tabIndexForChildItems = 0;
}
if (tabIndexForChildItems > display.Tabs.Count())
{
tabIndexForChildItems = display.Tabs.Count();
}
}
// Recreate tab list with child items tab at configured position
var tabs = new List<Tab<ContentPropertyDisplay>>();
tabs.AddRange(display.Tabs);
tabs.Insert(tabIndexForChildItems, listViewTab);
display.Tabs = tabs;
}
protected override IEnumerable<Tab<ContentPropertyDisplay>> ResolveCore(IContentBase content)

View File

@@ -19,6 +19,7 @@ namespace Umbraco.Web.PropertyEditors
return new Dictionary<string, object>
{
{"pageSize", "10"},
{"displayAtTabNumber", "1"},
{"orderBy", "SortOrder"},
{"orderDirection", "asc"},
{
@@ -50,6 +51,8 @@ namespace Umbraco.Web.PropertyEditors
internal class ListViewPreValueEditor : PreValueEditor
{
[PreValueField("displayAtTabNumber", "Display At Tab Number", "number", Description = "Which tab position that the list of child items will be displayed")]
public int DisplayAtTabNumber { get; set; }
[PreValueField("pageSize", "Page Size", "number", Description = "Number of items per page")]
public int PageSize { get; set; }
@@ -66,11 +69,9 @@ namespace Umbraco.Web.PropertyEditors
[PreValueField("includeProperties", "Columns Displayed", "views/propertyeditors/listview/includeproperties.prevalues.html",
Description = "The properties that will be displayed for each column")]
public object IncludeProperties { get; set; }
[PreValueField("bulkActionPermissions", "Bulk Action Permissions", "views/propertyeditors/listview/bulkactionpermissions.prevalues.html",
Description = "The bulk actions that are allowed from the list view")]
public BulkActionPermissionSettings BulkActionPermissions { get; set; }
internal class BulkActionPermissionSettings
{
public bool AllowBulkPublish { get; set; }