Fixed up validation messages when we are not redirecting, fixed up how we re-bind the content values to make sure we only set the values if they have been changed by the server and added unit tests for that. Added more properties to our display model including a new INotificationModel to put localized notifications in.

This commit is contained in:
Shannon
2013-07-22 17:13:38 +10:00
parent 8b7bbed1b5
commit b9d0bca1b6
5 changed files with 202 additions and 41 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Web.Http;
using System.Web.Http.ModelBinding;
@@ -12,8 +13,13 @@ namespace Umbraco.Web.Models.ContentEditing
/// A model representing a content item to be displayed in the back office
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class ContentItemDisplay : TabbedContentItem<ContentPropertyDisplay, IContent>
public class ContentItemDisplay : TabbedContentItem<ContentPropertyDisplay, IContent>, INotificationModel
{
public ContentItemDisplay()
{
Notifications = new List<Notification>();
}
[DataMember(Name = "publishDate")]
public DateTime? PublishDate { get; set; }
@@ -29,5 +35,11 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "ModelState")]
public IDictionary<string, object> Errors { 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")]
public List<Notification> Notifications { get; private set; }
}
}