2018-01-26 17:55:20 +01:00
using Newtonsoft.Json ;
using Umbraco.Core.PropertyEditors ;
2018-01-24 11:44:44 +01:00
namespace Umbraco.Web.PropertyEditors
{
/// <summary>
/// Represents the configuration for the listview value editor.
/// </summary>
public class ListViewConfiguration
{
2018-09-17 13:07:31 +02:00
public ListViewConfiguration ( )
{
// initialize defaults
PageSize = 10 ;
OrderBy = "SortOrder" ;
OrderDirection = "asc" ;
BulkActionPermissions = new BulkActionPermissionSettings
{
AllowBulkPublish = true ,
AllowBulkUnpublish = true ,
AllowBulkCopy = true ,
AllowBulkMove = true ,
AllowBulkDelete = true
} ;
Layouts = new [ ]
{
new Layout { Name = "List" , Icon = "icon-list" , IsSystem = 1 , Selected = true , Path = "views/propertyeditors/listview/layouts/list/list.html" } ,
new Layout { Name = "grid" , Icon = "icon-thumbnails-small" , IsSystem = 1 , Selected = true , Path = "views/propertyeditors/listview/layouts/grid/grid.html" }
} ;
IncludeProperties = new [ ]
{
new Property { Alias = "sortOrder" , Header = "Sort order" , IsSystem = 1 } ,
new Property { Alias = "updateDate" , Header = "Last edited" , IsSystem = 1 } ,
new Property { Alias = "owner" , Header = "Created by" , IsSystem = 1 }
} ;
}
2018-01-26 17:55:20 +01:00
[ConfigurationField("pageSize", "Page Size", "number", Description = "Number of items per page")]
public int PageSize { get ; set ; }
2018-07-31 13:05:54 +10:00
2018-01-26 17:55:20 +01:00
[ ConfigurationField ( "orderBy" , "Order By" , "views/propertyeditors/listview/sortby.prevalues.html" ,
Description = "The default sort order for the list" ) ]
public string OrderBy { get ; set ; }
[ConfigurationField("orderDirection", "Order Direction", "views/propertyeditors/listview/orderdirection.prevalues.html")]
public string OrderDirection { get ; set ; }
2018-01-24 11:44:44 +01:00
[ ConfigurationField ( "includeProperties" , "Columns Displayed" , "views/propertyeditors/listview/includeproperties.prevalues.html" ,
Description = "The properties that will be displayed for each column" ) ]
2018-01-26 17:55:20 +01:00
public Property [ ] IncludeProperties { get ; set ; }
2018-01-24 11:44:44 +01:00
2018-01-26 17:55:20 +01:00
[ConfigurationField("layouts", "Layouts", "views/propertyeditors/listview/layouts.prevalues.html")]
public Layout [ ] Layouts { get ; set ; }
2018-01-24 11:44:44 +01:00
[ ConfigurationField ( "bulkActionPermissions" , "Bulk Action Permissions" , "views/propertyeditors/listview/bulkactionpermissions.prevalues.html" ,
Description = "The bulk actions that are allowed from the list view" ) ]
2019-01-27 01:17:32 -05:00
public BulkActionPermissionSettings BulkActionPermissions { get ; set ; } = new BulkActionPermissionSettings ( ) ; // TODO: managing defaults?
2018-01-26 17:55:20 +01:00
2019-02-12 14:03:22 +11:00
[ConfigurationField("tabName", "Content app name", "textstring", Description = "The name of the listview content app (default if empty: 'Child Items')")]
2018-07-16 22:32:46 +10:00
public string TabName { get ; set ; }
2018-01-26 17:55:20 +01:00
public class Property
{
[JsonProperty("alias")]
public string Alias { get ; set ; }
[JsonProperty("header")]
public string Header { get ; set ; }
[JsonProperty("isSystem")]
2019-01-27 01:17:32 -05:00
public int IsSystem { get ; set ; } // TODO: bool
2018-01-26 17:55:20 +01:00
}
public class Layout
{
[JsonProperty("name")]
public string Name { get ; set ; }
[JsonProperty("path")]
public string Path { get ; set ; }
[JsonProperty("icon")]
public string Icon { get ; set ; }
[JsonProperty("isSystem")]
2019-01-27 01:17:32 -05:00
public int IsSystem { get ; set ; } // TODO: bool
2018-01-26 17:55:20 +01:00
[JsonProperty("selected")]
public bool Selected { get ; set ; }
}
2018-01-24 11:44:44 +01:00
public class BulkActionPermissionSettings
{
2018-01-26 17:55:20 +01:00
[JsonProperty("allowBulkPublish")]
public bool AllowBulkPublish { get ; set ; } = true ;
2018-01-24 11:44:44 +01:00
2018-01-26 17:55:20 +01:00
[JsonProperty("allowBulkUnpublish")]
public bool AllowBulkUnpublish { get ; set ; } = true ;
2018-01-24 11:44:44 +01:00
2018-01-26 17:55:20 +01:00
[JsonProperty("allowBulkCopy")]
public bool AllowBulkCopy { get ; set ; } = true ;
2018-01-24 11:44:44 +01:00
2018-01-26 17:55:20 +01:00
[JsonProperty("allowBulkMove")]
public bool AllowBulkMove { get ; set ; } = true ;
2018-01-24 11:44:44 +01:00
2018-01-26 17:55:20 +01:00
[JsonProperty("allowBulkDelete")]
public bool AllowBulkDelete { get ; set ; } = true ;
2018-01-24 11:44:44 +01:00
}
}
2018-07-16 22:32:46 +10:00
}