merge content/edit.html

This commit is contained in:
perploug
2013-08-16 13:29:23 +02:00
parent ddccc378d5
commit a82c367db8
16 changed files with 454 additions and 83 deletions

View File

@@ -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>();

View 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; }
}
}

View File

@@ -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
{

View File

@@ -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" />