Add a custom content item binder for saving blueprints (fixes #2985)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
827bc19f6a
commit
d16bc7a465
@@ -576,7 +576,7 @@ namespace Umbraco.Web.Editors
|
||||
[FileUploadCleanupFilter]
|
||||
[ContentPostValidate]
|
||||
public ContentItemDisplay PostSaveBlueprint(
|
||||
[ModelBinder(typeof(ContentItemBinder))] ContentItemSave contentItem)
|
||||
[ModelBinder(typeof(BlueprintItemBinder))] ContentItemSave contentItem)
|
||||
{
|
||||
var contentItemDisplay = PostSaveInternal(contentItem,
|
||||
content =>
|
||||
|
||||
@@ -823,6 +823,7 @@
|
||||
</Compile>
|
||||
<Compile Include="WebApi\AngularJsonMediaTypeFormatter.cs" />
|
||||
<Compile Include="WebApi\AngularJsonOnlyConfigurationAttribute.cs" />
|
||||
<Compile Include="WebApi\Binders\BlueprintItemBinder.cs" />
|
||||
<Compile Include="WebApi\Binders\MemberBinder.cs" />
|
||||
<Compile Include="WebApi\EnableDetailedErrorsAttribute.cs" />
|
||||
<Compile Include="WebApi\Filters\AngularAntiForgeryHelper.cs" />
|
||||
|
||||
28
src/Umbraco.Web/WebApi/Binders/BlueprintItemBinder.cs
Normal file
28
src/Umbraco.Web/WebApi/Binders/BlueprintItemBinder.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.Web.WebApi.Binders
|
||||
{
|
||||
internal class BlueprintItemBinder : ContentItemBinder
|
||||
{
|
||||
public BlueprintItemBinder(ApplicationContext applicationContext)
|
||||
: base(applicationContext)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public BlueprintItemBinder()
|
||||
: this(ApplicationContext.Current)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IContent GetExisting(ContentItemSave model)
|
||||
{
|
||||
return ApplicationContext.Services.ContentService.GetBlueprintById(Convert.ToInt32(model.Id));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user