mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
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:
@@ -41,6 +41,7 @@ namespace Orchard.DevTools.Controllers
|
|||||||
.Select(x => x.GetType())
|
.Select(x => x.GetType())
|
||||||
.SelectMany(x => AllTypes(x))
|
.SelectMany(x => AllTypes(x))
|
||||||
.Distinct();
|
.Distinct();
|
||||||
|
model.Displays = _contentManager.GetDisplays(model.Item);
|
||||||
model.Editors = _contentManager.GetEditors(model.Item);
|
model.Editors = _contentManager.GetEditors(model.Item);
|
||||||
|
|
||||||
return View(model);
|
return View(model);
|
||||||
|
|||||||
@@ -1,17 +1,7 @@
|
|||||||
using System;
|
using Orchard.Models.Driver;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using Orchard.Models;
|
|
||||||
using Orchard.Models.Driver;
|
|
||||||
using Orchard.UI.Models;
|
using Orchard.UI.Models;
|
||||||
|
|
||||||
namespace Orchard.DevTools.Models {
|
namespace Orchard.DevTools.Models {
|
||||||
|
|
||||||
public class ShowDebugLink {
|
|
||||||
public ContentItem ContentItem { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DebugLinkHandler : ContentHandler {
|
public class DebugLinkHandler : ContentHandler {
|
||||||
protected override void GetDisplays(GetDisplaysContext context) {
|
protected override void GetDisplays(GetDisplaysContext context) {
|
||||||
context.Displays.Add(new ModelTemplate { Model = new ShowDebugLink { ContentItem = context.ContentItem } });
|
context.Displays.Add(new ModelTemplate { Model = new ShowDebugLink { ContentItem = context.ContentItem } });
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
using Orchard.Models;
|
||||||
|
|
||||||
|
namespace Orchard.DevTools.Models {
|
||||||
|
public class ShowDebugLink {
|
||||||
|
public ContentItem ContentItem { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -65,6 +65,7 @@
|
|||||||
<Compile Include="Controllers\ContentController.cs" />
|
<Compile Include="Controllers\ContentController.cs" />
|
||||||
<Compile Include="Controllers\HomeController.cs" />
|
<Compile Include="Controllers\HomeController.cs" />
|
||||||
<Compile Include="Models\DebugLinkHandler.cs" />
|
<Compile Include="Models\DebugLinkHandler.cs" />
|
||||||
|
<Compile Include="Models\ShowDebugLink.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ViewModels\ContentIndexViewModel.cs" />
|
<Compile Include="ViewModels\ContentIndexViewModel.cs" />
|
||||||
<Compile Include="ViewModels\ContentDetailsViewModel.cs" />
|
<Compile Include="ViewModels\ContentDetailsViewModel.cs" />
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ namespace Orchard.DevTools.ViewModels {
|
|||||||
|
|
||||||
public IEnumerable<Type> PartTypes { get; set; }
|
public IEnumerable<Type> PartTypes { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<ModelTemplate> Displays { get; set; }
|
||||||
|
|
||||||
public IEnumerable<ModelTemplate> Editors { get; set; }
|
public IEnumerable<ModelTemplate> Editors { get; set; }
|
||||||
|
|
||||||
public object Locate(Type type) {
|
public object Locate(Type type) {
|
||||||
|
|||||||
@@ -82,6 +82,21 @@
|
|||||||
<%
|
<%
|
||||||
}%>
|
}%>
|
||||||
</ul>
|
</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>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<% Html.Include("footer"); %>
|
<% Html.Include("footer"); %>
|
||||||
|
|||||||
Reference in New Issue
Block a user