diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js index 01261a1265..87c23cadb9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js @@ -1,4 +1,4 @@ -function listViewController($rootScope, $scope, $routeParams, $injector, notificationsService, iconHelper, dialogService) { +function listViewController($rootScope, $scope, $routeParams, $injector, notificationsService, iconHelper, dialogService, editorState) { //this is a quick check to see if we're in create mode, if so just exit - we cannot show children for content // that isn't created yet, if we continue this will use the parent id in the route params which isn't what @@ -31,11 +31,13 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific // Set "default default" options (i.e. those if no container configuration has been saved) $scope.options = { - pageSize: 10, + pageSize: $scope.model.config.pageSize ? $scope.model.config.pageSize : 10, pageNumber: 1, filter: '', - orderBy: 'updateDate', - orderDirection: "desc", + orderBy: $scope.model.config.orderBy ? $scope.model.config.orderBy : 'UpdateDate', + orderDirection: $scope.model.config.orderDirection ? $scope.model.config.orderDirection : "desc" + //orderBy: 'updateDate', + //orderDirection: "desc", allowBulkPublish: true, allowBulkUnpublish: true, allowBulkDelete: true, @@ -360,6 +362,19 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific } }; + $scope.includeProperties = $scope.model.config.includeProperties ? _.map($scope.model.config.includeProperties, function (i) { + if (!i.label) + i.label = i.value.replace(/([A-Z]?[a-z]+)/g, '$1 ').trim(' '); + if (typeof (i.isProperty) == "undefined") + i.isProperty = !i.value.match("contentTypeAlias|createDate|icon|owner|published|sortOrder|updateDat|updator"); + if (!i.isProperty && !i.sortBy) + i.sortBy = i.value.substring(0, 1).toUpperCase() + i.value.slice(1); + // TODO: Add sort logic for custom properties. + //else if (!i.sortBy) + // ; + return i; + }) : {}; } + angular.module("umbraco").controller("Umbraco.PropertyEditors.ListViewController", listViewController); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html index 74d609e248..63617ec8d7 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html @@ -62,6 +62,13 @@ + +
@@ -95,6 +102,13 @@ {{getPropertyValue(column.alias, result)}} + + + {{result[property.value]}} + +
+ {{props.value}} +
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/orderDirection.prevalues.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/orderDirection.prevalues.html new file mode 100644 index 0000000000..6089990f6e --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/orderDirection.prevalues.html @@ -0,0 +1,12 @@ +
+ + + + Required +
\ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs index 95b7737a95..65278601ed 100644 --- a/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs @@ -11,7 +11,37 @@ namespace Umbraco.Web.PropertyEditors [PropertyEditor(Constants.PropertyEditors.ListViewAlias, "List view", "listview", HideLabel = true)] public class ListViewPropertyEditor : PropertyEditor { + protected override PreValueEditor CreatePreValueEditor() + { + return new ListViewPreValueEditor(); + } + public override IDictionary DefaultPreValues + { + get { + return new Dictionary + { + {"pageSize", "10"}, + {"orderBy", "SortOrder"}, + {"orderDirection", "asc"} + }; + } + } + + internal class ListViewPreValueEditor : PreValueEditor + { + [PreValueField("pageSize", "Page Size", "number", Description = "Number of items per page")] + public int PageSize { get; set; } + + [PreValueField("orderBy", "Order By", "textstring", Description = "SortOrder, Name, UpdateDate, CreateDate, ContentTypeAlias, UpdateDate, Updator or Owner")] + public int OrderBy { get; set; } + + [PreValueField("orderDirection", "Order By", "views/propertyeditors/listview/orderDirection.prevalues.html")] + public int OrderDirection { get; set; } + + [PreValueField("includeProperties", "Include Properties", "multivalues", Description = "Extra properties by name or custom properties by alias to include")] + public int IncludeProperties { get; set; } + } }