merge content/edit.html
This commit is contained in:
@@ -19,19 +19,29 @@ namespace Umbraco.Web.Editors
|
||||
[PluginController("UmbracoApi")]
|
||||
public class EntityController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
public IUmbracoEntity GetById(int id)
|
||||
public EntityDisplay GetById(int id)
|
||||
{
|
||||
return Services.EntityService.Get(id);
|
||||
|
||||
return map((UmbracoEntity)Services.EntityService.Get(id, UmbracoObjectTypes.Document));
|
||||
}
|
||||
|
||||
public IEnumerable<IUmbracoEntity> GetByIds([FromUri]int[] ids)
|
||||
public IEnumerable<EntityDisplay> GetByIds([FromUri]int[] ids)
|
||||
{
|
||||
if (ids == null) throw new ArgumentNullException("ids");
|
||||
|
||||
return ids.Select(id => Services.EntityService.Get(id)).Where(entity => entity != null).ToList();
|
||||
return ids.Select(id => map(((UmbracoEntity)Services.EntityService.Get(id, UmbracoObjectTypes.Document)))).Where(entity => entity != null).ToList();
|
||||
}
|
||||
|
||||
private EntityDisplay map(UmbracoEntity input)
|
||||
{
|
||||
EntityDisplay output = new EntityDisplay();
|
||||
output.Name = input.Name;
|
||||
output.Id = input.Id;
|
||||
output.Key = input.Key;
|
||||
output.Icon = input.ContentTypeIcon;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
//public IEnumerable<UmbracoEntity> GetContentByIds(int[] ids)
|
||||
//{
|
||||
// var list = new List<UmbracoEntity>();
|
||||
|
||||
25
src/Umbraco.Web/Models/ContentEditing/EntityDisplay.cs
Normal file
25
src/Umbraco.Web/Models/ContentEditing/EntityDisplay.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "entity", Namespace = "")]
|
||||
public class EntityDisplay
|
||||
{
|
||||
[DataMember(Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Name = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DataMember(Name = "key")]
|
||||
public Guid Key { get; set; }
|
||||
|
||||
[DataMember(Name = "icon")]
|
||||
public string Icon { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
//if there is no property editor it means that it is a legacy data type
|
||||
// we cannot support editing with that so we'll just render the readonly value view.
|
||||
display.View = GlobalSettings.Path.EnsureEndsWith('/') +
|
||||
"views/propertyeditors/umbraco/readonlyvalue/readonlyvalue.html";
|
||||
"views/propertyeditors/readonlyvalue/readonlyvalue.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -299,6 +299,7 @@
|
||||
<Compile Include="Editors\AuthenticationController.cs" />
|
||||
<Compile Include="Editors\ContentController.cs" />
|
||||
<Compile Include="Editors\EntityController.cs" />
|
||||
<Compile Include="Models\ContentEditing\EntityDisplay.cs" />
|
||||
<Compile Include="Models\ContentEditing\TemplateBasic.cs" />
|
||||
<Compile Include="Models\PagedResult.cs" />
|
||||
<Compile Include="PropertyEditors\DatePropertyEditor.cs" />
|
||||
|
||||
Reference in New Issue
Block a user