Getting the devtools details page to show display templates in addition to editor templates

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4041468
This commit is contained in:
loudej
2009-11-20 00:04:08 +00:00
parent 463490f648
commit 66700d9871
6 changed files with 27 additions and 11 deletions

View File

@@ -41,6 +41,7 @@ namespace Orchard.DevTools.Controllers
.Select(x => x.GetType())
.SelectMany(x => AllTypes(x))
.Distinct();
model.Displays = _contentManager.GetDisplays(model.Item);
model.Editors = _contentManager.GetEditors(model.Item);
return View(model);

View File

@@ -1,17 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Orchard.Models;
using Orchard.Models.Driver;
using Orchard.Models.Driver;
using Orchard.UI.Models;
namespace Orchard.DevTools.Models {
public class ShowDebugLink {
public ContentItem ContentItem { get; set; }
}
public class DebugLinkHandler : ContentHandler {
protected override void GetDisplays(GetDisplaysContext context) {
context.Displays.Add(new ModelTemplate { Model = new ShowDebugLink { ContentItem = context.ContentItem } });

View File

@@ -0,0 +1,7 @@
using Orchard.Models;
namespace Orchard.DevTools.Models {
public class ShowDebugLink {
public ContentItem ContentItem { get; set; }
}
}

View File

@@ -65,6 +65,7 @@
<Compile Include="Controllers\ContentController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Models\DebugLinkHandler.cs" />
<Compile Include="Models\ShowDebugLink.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModels\ContentIndexViewModel.cs" />
<Compile Include="ViewModels\ContentDetailsViewModel.cs" />

View File

@@ -13,6 +13,8 @@ namespace Orchard.DevTools.ViewModels {
public IEnumerable<Type> PartTypes { get; set; }
public IEnumerable<ModelTemplate> Displays { get; set; }
public IEnumerable<ModelTemplate> Editors { get; set; }
public object Locate(Type type) {

View File

@@ -82,6 +82,21 @@
<%
}%>
</ul>
<h3>
Displays</h3>
<ul>
<%foreach (var display in Model.Displays) {%>
<li><span style="font-weight: bold">
<%=Html.Encode(display.Prefix)%></span>
<%=Html.Encode(display.Model.GetType().Name)%>
(<%=Html.Encode(display.Model.GetType().Namespace)%>)
<div style="margin-left: 20px; border: solid 1px black;">
<%=Html.DisplayFor(x => display.Model, display.TemplateName, display.Prefix)%>
</div>
</li>
<%
}%>
</ul>
</div>
<div id="footer">
<% Html.Include("footer"); %>