Files
Umbraco-CMS/src/Umbraco.Core/Models/ContentEditing/ContentVariationDisplay.cs

83 lines
2.9 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
namespace Umbraco.Cms.Core.Models.ContentEditing
{
/// <summary>
/// Represents the variant info for a content item
/// </summary>
[DataContract(Name = "contentVariant", Namespace = "")]
public class ContentVariantDisplay : ITabbedContent<ContentPropertyDisplay>, IContentProperties<ContentPropertyDisplay>, INotificationModel
{
public ContentVariantDisplay()
{
Tabs = new List<Tab<ContentPropertyDisplay>>();
2020-01-20 11:37:19 +01:00
Notifications = new List<BackOfficeNotification>();
}
[DataMember(Name = "name", IsRequired = true)]
2022-01-21 11:43:58 +01:00
public string? Name { get; set; }
[DataMember(Name = "displayName")]
2022-01-21 11:43:58 +01:00
public string? DisplayName { get; set; }
/// <summary>
/// Defines the tabs containing display properties
/// </summary>
[DataMember(Name = "tabs")]
public IEnumerable<Tab<ContentPropertyDisplay>> Tabs { get; set; }
/// <summary>
/// Internal property used for tests to get all properties from all tabs
/// </summary>
[IgnoreDataMember]
2022-01-21 11:43:58 +01:00
IEnumerable<ContentPropertyDisplay> IContentProperties<ContentPropertyDisplay>.Properties => Tabs.Where(x => x.Properties is not null).SelectMany(x => x.Properties!);
/// <summary>
/// The language/culture assigned to this content variation
/// </summary>
/// <remarks>
/// If this is null it means this content variant is an invariant culture
/// </remarks>
[DataMember(Name = "language")]
2022-01-21 11:43:58 +01:00
public Language? Language { get; set; }
[DataMember(Name = "segment")]
2022-01-21 11:43:58 +01:00
public string? Segment { get; set; }
[DataMember(Name = "state")]
public ContentSavedState State { get; set; }
[DataMember(Name = "updateDate")]
public DateTime UpdateDate { get; set; }
[DataMember(Name = "createDate")]
public DateTime CreateDate { get; set; }
[DataMember(Name = "publishDate")]
public DateTime? PublishDate { get; set; }
/// <summary>
/// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes.
/// </summary>
/// <remarks>
/// The notifications assigned to a variant are currently only used to show custom messages in the save/publish dialogs.
/// </remarks>
[DataMember(Name = "notifications")]
[ReadOnly(true)]
2020-01-20 11:37:19 +01:00
public List<BackOfficeNotification> Notifications { get; private set; }
}
public class ContentVariantScheduleDisplay : ContentVariantDisplay
{
[DataMember(Name = "releaseDate")]
public DateTime? ReleaseDate { get; set; }
[DataMember(Name = "expireDate")]
public DateTime? ExpireDate { get; set; }
}
}