Merge pull request #7460 from umbraco/netcore/feature/AB4549-Move-models-from-web
Netcore: Move models from web to abstractions and infrastructure
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Editors;
|
||||
|
||||
@@ -30,7 +28,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
|
||||
[DataMember(Name = "variants", IsRequired = true)]
|
||||
public IEnumerable<ContentVariantSave> Variants { get; set; }
|
||||
|
||||
|
||||
[DataMember(Name = "contentTypeAlias", IsRequired = true)]
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string ContentTypeAlias { get; set; }
|
||||
@@ -40,7 +38,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// </summary>
|
||||
[DataMember(Name = "templateAlias")]
|
||||
public string TemplateAlias { get; set; }
|
||||
|
||||
|
||||
#region IContentSave
|
||||
|
||||
[DataMember(Name = "action", IsRequired = true)]
|
||||
@@ -54,7 +52,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// <inheritdoc />
|
||||
[IgnoreDataMember]
|
||||
IContent IContentSave<IContent>.PersistedContent { get; set; }
|
||||
|
||||
|
||||
//Non explicit internal getter so we don't need to explicitly cast in our own code
|
||||
[IgnoreDataMember]
|
||||
internal IContent PersistedContent
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
@@ -11,7 +9,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// <remarks>
|
||||
/// This is only used during mapping operations, it is not used for angular purposes
|
||||
/// </remarks>
|
||||
internal class ContentPropertyCollectionDto : IContentProperties<ContentPropertyDto>
|
||||
public class ContentPropertyCollectionDto : IContentProperties<ContentPropertyDto>
|
||||
{
|
||||
public ContentPropertyCollectionDto()
|
||||
{
|
||||
@@ -1,14 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a content property from the database
|
||||
/// </summary>
|
||||
internal class ContentPropertyDto : ContentPropertyBasic
|
||||
public class ContentPropertyDto : ContentPropertyBasic
|
||||
{
|
||||
public IDataType DataType { get; set; }
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// An interface exposes the shared parts of content, media, members that we use during model binding in order to share logic
|
||||
/// </summary>
|
||||
/// <typeparam name="TPersisted"></typeparam>
|
||||
internal interface IContentSave<TPersisted> : IHaveUploadedFiles
|
||||
public interface IContentSave<TPersisted> : IHaveUploadedFiles
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
/// <summary>
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web;
|
||||
using Umbraco.Core.Composing;
|
||||
using System.Net;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Web.Models
|
||||
@@ -22,7 +21,7 @@ namespace Umbraco.Web.Models
|
||||
{
|
||||
Type = upgradeType;
|
||||
Comment = upgradeComment;
|
||||
Url = upgradeUrl + "?version=" + HttpUtility.UrlEncode(umbracoVersion.Current.ToString(3));
|
||||
Url = upgradeUrl + "?version=" + WebUtility.UrlEncode(umbracoVersion.Current.ToString(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,14 @@
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "notification", Namespace = "")]
|
||||
public class Notification
|
||||
public class BackOfficeNotification
|
||||
{
|
||||
public Notification()
|
||||
public BackOfficeNotification()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Notification(string header, string message, NotificationStyle notificationType)
|
||||
public BackOfficeNotification(string header, string message, NotificationStyle notificationType)
|
||||
{
|
||||
Header = header;
|
||||
Message = message;
|
||||
@@ -25,6 +25,6 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
|
||||
[DataMember(Name = "type")]
|
||||
public NotificationStyle NotificationType { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
public CodeFileDisplay()
|
||||
{
|
||||
Notifications = new List<Notification>();
|
||||
Notifications = new List<BackOfficeNotification>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -53,7 +53,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
[ReadOnly(true)]
|
||||
public string Id { get; set; }
|
||||
|
||||
public List<Notification> Notifications { get; private set; }
|
||||
public List<BackOfficeNotification> Notifications { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Some custom validation is required for valid file names
|
||||
@@ -31,10 +31,10 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// <inheritdoc />
|
||||
[IgnoreDataMember]
|
||||
TPersisted IContentSave<TPersisted>.PersistedContent { get; set; }
|
||||
|
||||
|
||||
//Non explicit internal getter so we don't need to explicitly cast in our own code
|
||||
[IgnoreDataMember]
|
||||
internal TPersisted PersistedContent
|
||||
public TPersisted PersistedContent
|
||||
{
|
||||
get => ((IContentSave<TPersisted>)this).PersistedContent;
|
||||
set => ((IContentSave<TPersisted>) this).PersistedContent = value;
|
||||
@@ -49,7 +49,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// This is not used for outgoing model information.
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
internal ContentPropertyCollectionDto PropertyCollectionDto { get; set; }
|
||||
public ContentPropertyCollectionDto PropertyCollectionDto { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
public ContentItemDisplay()
|
||||
{
|
||||
AllowPreview = true;
|
||||
Notifications = new List<Notification>();
|
||||
Notifications = new List<BackOfficeNotification>();
|
||||
Errors = new Dictionary<string, object>();
|
||||
Variants = new List<ContentVariantDisplay>();
|
||||
ContentApps = new List<ContentApp>();
|
||||
@@ -173,7 +173,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// This is not used for outgoing model information.
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
internal IContent PersistedContent { get; set; }
|
||||
public IContent PersistedContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The DTO object used to gather all required content data including data type information etc... for use with validation - used during inbound model binding
|
||||
@@ -184,14 +184,14 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// This is not used for outgoing model information.
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
internal ContentPropertyCollectionDto ContentDto { get; set; }
|
||||
public ContentPropertyCollectionDto ContentDto { 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>
|
||||
[DataMember(Name = "notifications")]
|
||||
[ReadOnly(true)]
|
||||
public List<Notification> Notifications { get; private set; }
|
||||
public List<BackOfficeNotification> Notifications { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is used for validation of a content item.
|
||||
@@ -10,7 +10,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
protected ContentItemDisplayBase()
|
||||
{
|
||||
Notifications = new List<Notification>();
|
||||
Notifications = new List<BackOfficeNotification>();
|
||||
Errors = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// </summary>
|
||||
[DataMember(Name = "notifications")]
|
||||
[ReadOnly(true)]
|
||||
public List<Notification> Notifications { get; private set; }
|
||||
public List<BackOfficeNotification> Notifications { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is used for validation of a content item.
|
||||
@@ -4,7 +4,7 @@ using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Composing;
|
||||
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
@@ -67,15 +67,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// </summary>
|
||||
[DataMember(Name = "iconFilePath")]
|
||||
[ReadOnly(true)]
|
||||
public string IconFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
return IconIsClass
|
||||
? string.Empty
|
||||
: string.Format("{0}images/umbraco/{1}", Current.Configs.Global().Path.EnsureEndsWith("/"), Icon);
|
||||
}
|
||||
}
|
||||
public string IconFilePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the icon represents a CSS class instead of a file path
|
||||
@@ -100,15 +92,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// </summary>
|
||||
[DataMember(Name = "thumbnailFilePath")]
|
||||
[ReadOnly(true)]
|
||||
public string ThumbnailFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
return ThumbnailIsClass
|
||||
? string.Empty
|
||||
: Current.IOHelper.ResolveUrl("~/umbraco/images/thumbnails/" + Thumbnail);
|
||||
}
|
||||
}
|
||||
public string ThumbnailFilePath { get; set; }
|
||||
|
||||
[DataMember(Name = "blueprints")]
|
||||
[ReadOnly(true)]
|
||||
@@ -11,7 +11,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
//initialize collections so at least their never null
|
||||
AllowedContentTypes = new List<int>();
|
||||
CompositeContentTypes = new List<string>();
|
||||
Notifications = new List<Notification>();
|
||||
Notifications = new List<BackOfficeNotification>();
|
||||
}
|
||||
|
||||
//name, alias, icon, thumb, desc, inherited from basic
|
||||
@@ -40,7 +40,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// </summary>
|
||||
[DataMember(Name = "notifications")]
|
||||
[ReadOnly(true)]
|
||||
public List<Notification> Notifications { get; private set; }
|
||||
public List<BackOfficeNotification> Notifications { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is used for validation of a content item.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user