From ae2ed170501a2e72e194970804b6cd97033468fd Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 22 Jul 2013 17:13:56 +1000 Subject: [PATCH] missing files. --- .../ContentEditing/INotificationModel.cs | 12 ++++ .../ContentEditing/MessagesExtensions.cs | 57 +++++++++++++++++++ .../Models/ContentEditing/Notification.cs | 16 ++++++ src/Umbraco.Web/Umbraco.Web.csproj | 3 + 4 files changed, 88 insertions(+) create mode 100644 src/Umbraco.Web/Models/ContentEditing/INotificationModel.cs create mode 100644 src/Umbraco.Web/Models/ContentEditing/MessagesExtensions.cs create mode 100644 src/Umbraco.Web/Models/ContentEditing/Notification.cs diff --git a/src/Umbraco.Web/Models/ContentEditing/INotificationModel.cs b/src/Umbraco.Web/Models/ContentEditing/INotificationModel.cs new file mode 100644 index 0000000000..2ffd10d8b6 --- /dev/null +++ b/src/Umbraco.Web/Models/ContentEditing/INotificationModel.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace Umbraco.Web.Models.ContentEditing +{ + public interface INotificationModel + { + /// + /// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes. + /// + List Notifications { get; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Models/ContentEditing/MessagesExtensions.cs b/src/Umbraco.Web/Models/ContentEditing/MessagesExtensions.cs new file mode 100644 index 0000000000..87371c8551 --- /dev/null +++ b/src/Umbraco.Web/Models/ContentEditing/MessagesExtensions.cs @@ -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 + }); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Models/ContentEditing/Notification.cs b/src/Umbraco.Web/Models/ContentEditing/Notification.cs new file mode 100644 index 0000000000..c5c5634442 --- /dev/null +++ b/src/Umbraco.Web/Models/ContentEditing/Notification.cs @@ -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; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 4b0088854d..9bbd85616f 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -308,7 +308,10 @@ + + +