missing files.

This commit is contained in:
Shannon
2013-07-22 17:13:56 +10:00
parent b9d0bca1b6
commit ae2ed17050
4 changed files with 88 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace Umbraco.Web.Models.ContentEditing
{
public interface INotificationModel
{
/// <summary>
/// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes.
/// </summary>
List<Notification> Notifications { get; }
}
}

View File

@@ -0,0 +1,57 @@
using Umbraco.Web.UI;
namespace Umbraco.Web.Models.ContentEditing
{
public static class MessagesExtensions
{
public static void AddNotification(this INotificationModel model, string header, string msg, SpeechBubbleIcon type)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = type
});
}
public static void AddSuccessNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Success
});
}
public static void AddErrorNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Error
});
}
public static void AddWarningNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Warning
});
}
public static void AddInfoNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Info
});
}
}
}

View File

@@ -0,0 +1,16 @@
using System.Runtime.Serialization;
using Umbraco.Web.UI;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "notification", Namespace = "")]
public class Notification
{
[DataMember(Name = "header")]
public string Header { get; set; }
[DataMember(Name = "message")]
public string Message { get; set; }
[DataMember(Name = "type")]
public SpeechBubbleIcon NotificationType { get; set; }
}
}

View File

@@ -308,7 +308,10 @@
<Compile Include="Models\ContentEditing\ContentSaveAction.cs" />
<Compile Include="Models\ContentEditing\ContentTypeBasic.cs" />
<Compile Include="Models\ContentEditing\IHaveUploadedFiles.cs" />
<Compile Include="Models\ContentEditing\INotificationModel.cs" />
<Compile Include="Models\ContentEditing\MediaItemDisplay.cs" />
<Compile Include="Models\ContentEditing\MessagesExtensions.cs" />
<Compile Include="Models\ContentEditing\Notification.cs" />
<Compile Include="Models\ContentEditing\Section.cs" />
<Compile Include="Models\ContentEditing\Tab.cs" />
<Compile Include="Models\ContentEditing\TabbedContentItem.cs" />