Merge branch 'v8/dev' into v8/feature/5170-IPublishedContent
# Conflicts: # src/Umbraco.Web.UI.Client/package-lock.json
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
public static class MessagesExtensions
|
||||
{
|
||||
public static void AddNotification(this INotificationModel model, string header, string msg, NotificationStyle type)
|
||||
{
|
||||
if (model.Exists(header, msg, type)) return;
|
||||
|
||||
model.Notifications.Add(new Notification()
|
||||
{
|
||||
Header = header,
|
||||
@@ -15,6 +20,8 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
|
||||
public static void AddSuccessNotification(this INotificationModel model, string header, string msg)
|
||||
{
|
||||
if (model.Exists(header, msg, NotificationStyle.Success)) return;
|
||||
|
||||
model.Notifications.Add(new Notification()
|
||||
{
|
||||
Header = header,
|
||||
@@ -25,6 +32,8 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
|
||||
public static void AddErrorNotification(this INotificationModel model, string header, string msg)
|
||||
{
|
||||
if (model.Exists(header, msg, NotificationStyle.Error)) return;
|
||||
|
||||
model.Notifications.Add(new Notification()
|
||||
{
|
||||
Header = header,
|
||||
@@ -35,6 +44,8 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
|
||||
public static void AddWarningNotification(this INotificationModel model, string header, string msg)
|
||||
{
|
||||
if (model.Exists(header, msg, NotificationStyle.Warning)) return;
|
||||
|
||||
model.Notifications.Add(new Notification()
|
||||
{
|
||||
Header = header,
|
||||
@@ -45,6 +56,8 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
|
||||
public static void AddInfoNotification(this INotificationModel model, string header, string msg)
|
||||
{
|
||||
if (model.Exists(header, msg, NotificationStyle.Info)) return;
|
||||
|
||||
model.Notifications.Add(new Notification()
|
||||
{
|
||||
Header = header,
|
||||
@@ -52,5 +65,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
NotificationType = NotificationStyle.Info
|
||||
});
|
||||
}
|
||||
|
||||
private static bool Exists(this INotificationModel model, string header, string message, NotificationStyle notificationType) => model.Notifications.Any(x => x.Header.InvariantEquals(header) && x.Message.InvariantEquals(message) && x.NotificationType == notificationType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
variants.Remove(defaultLang);
|
||||
|
||||
//Sort the remaining languages a-z
|
||||
variants = variants.OrderBy(x => x.Name).ToList();
|
||||
variants = variants.OrderBy(x => x.Language.Name).ToList();
|
||||
|
||||
//Insert the default language as the first item
|
||||
variants.Insert(0, defaultLang);
|
||||
|
||||
@@ -45,6 +45,12 @@ namespace Umbraco.Web.Models.Mapping
|
||||
if (source.NodeObjectType == Constants.ObjectTypes.Member && target.Icon.IsNullOrWhiteSpace())
|
||||
target.Icon = "icon-user";
|
||||
|
||||
if (source.NodeObjectType == Constants.ObjectTypes.Media && source is IContentEntitySlim contentSlim)
|
||||
source.AdditionalData["ContentTypeAlias"] = contentSlim.ContentTypeAlias;
|
||||
|
||||
if (source.NodeObjectType == Constants.ObjectTypes.Media && source is IMediaEntitySlim mediaSlim)
|
||||
source.AdditionalData["MediaPath"] = mediaSlim.MediaPath;
|
||||
|
||||
// NOTE: we're mapping the objects in AdditionalData by object reference here.
|
||||
// it works fine for now, but it's something to keep in mind in the future
|
||||
foreach(var kvp in source.AdditionalData)
|
||||
|
||||
Reference in New Issue
Block a user