Getting models and value converter setup along with tests
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Core.Models.Blocks
|
||||
@@ -8,9 +10,20 @@ namespace Umbraco.Core.Models.Blocks
|
||||
/// </summary>
|
||||
public abstract class BlockEditorModel
|
||||
{
|
||||
protected BlockEditorModel(IEnumerable<IPublishedElement> data)
|
||||
{
|
||||
Data = data ?? throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
|
||||
public BlockEditorModel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The data items of the Block List editor
|
||||
/// </summary>
|
||||
public IEnumerable<IPublishedElement> Data { get; }
|
||||
[DataMember(Name = "data")]
|
||||
public IEnumerable<IPublishedElement> Data { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Core.Models.Blocks
|
||||
@@ -6,6 +7,7 @@ namespace Umbraco.Core.Models.Blocks
|
||||
/// <summary>
|
||||
/// Represents a layout item for the Block List editor
|
||||
/// </summary>
|
||||
[DataContract(Name = "blockListLayout", Namespace = "")]
|
||||
public class BlockListLayoutReference : IBlockElement<IPublishedElement>
|
||||
{
|
||||
public BlockListLayoutReference(Udi udi, IPublishedElement settings)
|
||||
@@ -14,7 +16,10 @@ namespace Umbraco.Core.Models.Blocks
|
||||
Settings = settings ?? throw new ArgumentNullException(nameof(settings));
|
||||
}
|
||||
|
||||
public Udi Udi { get; }
|
||||
public IPublishedElement Settings { get; }
|
||||
[DataMember(Name = "udi")]
|
||||
public Udi Udi { get; set; }
|
||||
|
||||
[DataMember(Name = "settings")]
|
||||
public IPublishedElement Settings { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Core.Models.Blocks
|
||||
{
|
||||
/// <summary>
|
||||
/// The strongly typed model for the Block List editor
|
||||
/// </summary>
|
||||
[DataContract(Name = "blockList", Namespace = "")]
|
||||
public class BlockListModel : BlockEditorModel
|
||||
{
|
||||
public BlockListModel(IEnumerable<IPublishedElement> data, IEnumerable<BlockListLayoutReference> layout)
|
||||
: base(data)
|
||||
{
|
||||
Layout = layout;
|
||||
}
|
||||
|
||||
public BlockListModel()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The layout items of the Block List editor
|
||||
/// </summary>
|
||||
public IEnumerable<BlockListLayoutReference> Layout { get; }
|
||||
[DataMember(Name = "layout")]
|
||||
public IEnumerable<BlockListLayoutReference> Layout { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user