mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 01:57:55 +08:00
Adding a mini-addon to devtools to show the contenttype, id, and link to the dev-details page for the item.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4041465
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Orchard.Models;
|
||||
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 } });
|
||||
}
|
||||
protected override void GetEditors(GetEditorsContext context) {
|
||||
context.Editors.Add(new ModelTemplate { Model = new ShowDebugLink { ContentItem = context.ContentItem } });
|
||||
}
|
||||
}
|
||||
}
|
@@ -64,6 +64,7 @@
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Controllers\ContentController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Models\DebugLinkHandler.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\ContentIndexViewModel.cs" />
|
||||
<Compile Include="ViewModels\ContentDetailsViewModel.cs" />
|
||||
@@ -73,6 +74,8 @@
|
||||
<Content Include="Views\Content\Details.aspx" />
|
||||
<Content Include="Views\Content\Index.aspx" />
|
||||
<Content Include="Views\Home\Index.aspx" />
|
||||
<Content Include="Views\Models\DisplayTemplates\ShowDebugLink.ascx" />
|
||||
<Content Include="Views\Models\EditorTemplates\ShowDebugLink.ascx" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Views\Web.config" />
|
||||
</ItemGroup>
|
||||
@@ -84,7 +87,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
@@ -0,0 +1,5 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ShowDebugLink>" %>
|
||||
<%@ Import Namespace="Orchard.DevTools.Models" %>
|
||||
<div>
|
||||
DevTools: showing
|
||||
<%= Html.ActionLink(Model.ContentItem.ContentType + " #" + Model.ContentItem.Id, "details", "content", new { area = "Orchard.DevTools", Model.ContentItem.Id }, new { })%></div>
|
@@ -0,0 +1,5 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ShowDebugLink>" %>
|
||||
<%@ Import Namespace="Orchard.DevTools.Models" %>
|
||||
<div>
|
||||
DevTools: editing
|
||||
<%= Html.ActionLink(Model.ContentItem.ContentType + " #" + Model.ContentItem.Id, "details", "content", new { area = "Orchard.DevTools", Model.ContentItem.Id }, new { })%></div>
|
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Data;
|
||||
using Orchard.Models;
|
||||
using Orchard.Models.Driver;
|
||||
using Orchard.Wikis.Models;
|
||||
using Orchard.Wikis.ViewModels;
|
||||
|
||||
namespace Orchard.Wikis.Controllers
|
||||
{
|
||||
public class Home : Controller {
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
return RedirectToAction("index","page");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -63,6 +63,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Controllers\PageController.cs" />
|
||||
<Compile Include="Models\WikiPage.cs" />
|
||||
<Compile Include="Models\WikiPageHandler.cs" />
|
||||
|
@@ -59,6 +59,10 @@ namespace Orchard.Models {
|
||||
// obtain root record to determine the model type
|
||||
var contentItemRecord = _contentItemRepository.Get(id);
|
||||
|
||||
// no record of that id means content item doesn't exist
|
||||
if (contentItemRecord == null)
|
||||
return null;
|
||||
|
||||
// create a context with a new instance to load
|
||||
var context = new LoadContentContext {
|
||||
Id = contentItemRecord.Id,
|
||||
|
Reference in New Issue
Block a user