Adding UI feedback for invalid compositions

This commit is contained in:
Morten Christensen
2014-12-12 17:04:53 +01:00
parent ed899ec73d
commit 2a9960afb3

View File

@@ -16,6 +16,7 @@ using System.Web.UI.WebControls;
using ClientDependency.Core;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Strings;
@@ -351,8 +352,16 @@ namespace umbraco.controls
var compositionType = isMediaType
? Services.ContentTypeService.GetMediaType(compositionId).SafeCast<IContentTypeComposition>()
: Services.ContentTypeService.GetContentType(compositionId).SafeCast<IContentTypeComposition>();
var added = _contentType.ContentTypeItem.AddContentType(compositionType);
//TODO if added=false then return error message
try
{
//TODO if added=false then return error message
var added = _contentType.ContentTypeItem.AddContentType(compositionType);
}
catch (InvalidCompositionException ex)
{
state.SaveArgs.IconType = BasePage.speechBubbleIcon.error;
state.SaveArgs.Message = ex.Message;
}
}
// then iterate over removed = existing except checked