mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Throwing in a "SummaryAdmin" equivalent
Need to enumerate display types Adds a diagnostic <div> to devtools that wraps everything being rendered with it's shape name and location --HG-- branch : theming
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BodyDisplayViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Common.ViewModels"%>
|
||||
<%=Model.Text %>
|
||||
<%:Model.Html %>
|
||||
@@ -117,8 +117,13 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
var list = Shape.List();
|
||||
list.AddRange(contentItems);
|
||||
|
||||
var list2 = Shape.List();
|
||||
var items = contentItems.Select(ci=>_contentManager.BuildDisplayModel(ci, "SummaryAdmin"));
|
||||
list2.AddRange(items);
|
||||
|
||||
var viewModel = Shape.ViewModel()
|
||||
.ContentItems(list)
|
||||
.ContentItems2(list2)
|
||||
.Options(model.Options)
|
||||
.TypeDisplayName(model.TypeDisplayName ?? "");
|
||||
|
||||
|
||||
15
src/Orchard.Web/Core/Contents/Shapes.cs
Normal file
15
src/Orchard.Web/Core/Contents/Shapes.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.UI.Zones;
|
||||
|
||||
namespace Orchard.Core.Contents {
|
||||
public class Shapes : IShapeFactoryEvents {
|
||||
|
||||
public void Creating(ShapeCreatingContext creating) {
|
||||
if (creating.ShapeType.StartsWith("Items_Content"))
|
||||
creating.Behaviors.Add(new ZoneHoldingBehavior(creating.ShapeFactory));
|
||||
}
|
||||
|
||||
public void Created(ShapeCreatedContext created) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
@using Orchard.Core.Contents.ViewModels
|
||||
<h1>@//Html.TitleForPage((string.IsNullOrEmpty(Model.TypeDisplayName) ? T("Manage Content") : T("Manage {0} Content", Model.TypeDisplayName)).ToString())</h1>
|
||||
<h1>@//Html.TitleForPage((string.IsNullOrEmpty(Model.TypeDisplayName) ? T("Manage Content") : T("Manage {0} Content", Model.TypeDisplayName)).ToString())
|
||||
</h1>
|
||||
<div class="manage">
|
||||
@Html.ActionLink((string)(!string.IsNullOrEmpty((string)Model.TypeDisplayName) ? T("Create New {0}", Model.TypeDisplayName).Text : T("Create New Content").Text), "Create", null, new { @class = "button primaryAction" })
|
||||
</div>
|
||||
@@ -31,5 +32,6 @@
|
||||
</fieldset>
|
||||
<fieldset class="contentItems bulk-items">
|
||||
@Display(Model.ContentItems)
|
||||
@Display(Model.ContentItems2)
|
||||
</fieldset>
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@using Orchard.ContentManagement
|
||||
@using Orchard.Utility.Extensions
|
||||
@{
|
||||
ContentItem contentItem = Model.ContentItem;
|
||||
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
|
||||
}
|
||||
|
||||
<div class="summary" itemscope="itemscope" itemid="@contentItem.Id" itemtype="http://orchardproject.net/data/ContentItem">
|
||||
<div class="properties">
|
||||
<input type="checkbox" value="@contentItem.Id" name="itemIds"/>
|
||||
<h3>@Html.ItemEditLink(contentItem)</h3>
|
||||
<div class="metadata">@Display(Model.metadata)</div>
|
||||
</div>
|
||||
<div class="related">@Display(Model.secondary)
|
||||
@Html.ItemEditLink(T("Edit").Text, contentItem) @T(" | ")
|
||||
@Html.Link(T("Remove").Text, Url.Action("Remove", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl }), new { itemprop = "RemoveUrl UnsafeUrl" })
|
||||
<br />@Display(Model.meta)
|
||||
</div>
|
||||
<div class="primary">@Display(Model.primary)</div>
|
||||
</div>
|
||||
@@ -21,7 +21,7 @@ namespace Orchard.Core.Dashboard.Controllers {
|
||||
|
||||
var list = shape.List();
|
||||
|
||||
list.Add(_contentManager.BuildDisplayModel(CurrentUser, "Detail"));
|
||||
list.Add(_contentManager.BuildDisplayModel(CurrentUser, ""));
|
||||
foreach (var contentItem in _contentManager.Query().Join<BodyPartRecord>().List()) {
|
||||
list.Add(_contentManager.BuildDisplayModel(contentItem, "Summary"));
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
<Compile Include="Contents\Routes.cs" />
|
||||
<Compile Include="Contents\Settings\ContentTypeSettings.cs" />
|
||||
<Compile Include="Contents\Settings\ContentPartSettings.cs" />
|
||||
<Compile Include="Contents\Shapes.cs" />
|
||||
<Compile Include="Contents\ViewModels\PublishContentViewModel.cs" />
|
||||
<Compile Include="Localization\ViewModels\EditLocalizationViewModel.cs" />
|
||||
<Compile Include="Messaging\DataMigrations\MessagingDataMigration.cs" />
|
||||
@@ -402,6 +403,7 @@
|
||||
<None Include="Contents\Views\Items\Content.cshtml" />
|
||||
<None Include="Contents\Views\Items\Content.Edit.cshtml" />
|
||||
<None Include="Contents\Views\Items\Content.Summary.cshtml" />
|
||||
<None Include="Contents\Views\Items\Content.SummaryAdmin.cshtml" />
|
||||
<None Include="Contents\Views\Item\Display.cshtml" />
|
||||
<None Include="HomePage\Views\HomePage.cshtml" />
|
||||
<None Include="Shapes\Views\Document.cshtml" />
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
@@ -8,7 +6,6 @@ using System.Web.Mvc;
|
||||
using System.Web.Mvc.Html;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.DisplayManagement.Descriptors;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.UI;
|
||||
using Orchard.UI.Zones;
|
||||
@@ -30,9 +27,6 @@ namespace Orchard.Core.Shapes {
|
||||
created.Shape.Zones.Body.Add(created.New.PlaceChildContent(Source: created.Shape), "5");
|
||||
});
|
||||
|
||||
builder.Describe.Named("Items_Content").From(Feature.Descriptor)
|
||||
.OnCreating(creating => creating.Behaviors.Add(new ZoneHoldingBehavior(creating.ShapeFactory)));
|
||||
|
||||
// 'Zone' shapes are built on the Zone base class
|
||||
builder.Describe.Named("Zone").From(Feature.Descriptor)
|
||||
.OnCreating(creating => creating.BaseType = typeof(Zone));
|
||||
@@ -135,8 +129,8 @@ namespace Orchard.Core.Shapes {
|
||||
}
|
||||
|
||||
static string DeterminePrefix(HtmlHelper Html, string Prefix) {
|
||||
var actualPrefix = string.IsNullOrEmpty(Prefix)
|
||||
? Html.ViewContext.ViewData.TemplateInfo.HtmlFieldPrefix
|
||||
var actualPrefix = string.IsNullOrEmpty(Prefix)
|
||||
? Html.ViewContext.ViewData.TemplateInfo.HtmlFieldPrefix
|
||||
: Html.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(Prefix);
|
||||
return actualPrefix;
|
||||
}
|
||||
@@ -147,4 +141,4 @@ namespace Orchard.Core.Shapes {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
}
|
||||
@//Model.Zones.AddRenderPartial("head:before", "HeadPreload", Model);
|
||||
@//Html.Zone("head", ":metas :styles :scripts"); %>
|
||||
@Display(Model.Head)
|
||||
<script>(function(d){d.className="dyn "+d.className.substring(7,d.length);})(document.documentElement);</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
<Content Include="ScaffoldingTemplates\DataMigration.txt" />
|
||||
<Compile Include="Services\ScaffoldingCommandInterpreter.cs" />
|
||||
<Compile Include="Settings\DevToolsSettings.cs" />
|
||||
<Compile Include="Shapes.cs" />
|
||||
<Compile Include="ViewModels\CommandsExecuteViewModel.cs" />
|
||||
<Compile Include="ViewModels\ContentIndexViewModel.cs" />
|
||||
<Compile Include="ViewModels\ContentDetailsViewModel.cs" />
|
||||
@@ -126,6 +127,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Views\ThinBorder.cshtml" />
|
||||
<None Include="Views\Home\FormShapes.cshtml" />
|
||||
<None Include="Views\Home\UsingShapes.cshtml" />
|
||||
<None Include="Views\Inventory\ShapeTable.cshtml" />
|
||||
|
||||
13
src/Orchard.Web/Modules/Orchard.DevTools/Shapes.cs
Normal file
13
src/Orchard.Web/Modules/Orchard.DevTools/Shapes.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
|
||||
namespace Orchard.DevTools {
|
||||
public class Shapes : IShapeFactoryEvents {
|
||||
public void Creating(ShapeCreatingContext context) {
|
||||
|
||||
}
|
||||
|
||||
public void Created(ShapeCreatedContext context) {
|
||||
context.Shape.Metadata.Wrappers.Add("ThinBorder");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@using Orchard
|
||||
@using Orchard.DisplayManagement.Descriptors
|
||||
@{
|
||||
var workContext = ViewContext.GetWorkContext();
|
||||
var shapeTable = workContext.Resolve<IShapeTableManager>().GetShapeTable(workContext.CurrentTheme.ThemeName);
|
||||
var descriptor = shapeTable.Descriptors[Model.Metadata.Type];
|
||||
}
|
||||
<div class="thinborder" title="@Model.Metadata.Type @descriptor.BindingSource">@Display(Model.Metadata.ChildContent)</div>
|
||||
@@ -383,8 +383,7 @@ namespace Orchard.ContentManagement {
|
||||
var shapeHelper = _shapeHelperFactory.CreateHelper();
|
||||
|
||||
var shapeTypeName = string.IsNullOrEmpty(displayType) ? "Items_Content" : ("Items_Content_" + displayType);
|
||||
_shapeHelperCalls.Invoke(shapeHelper, shapeTypeName);
|
||||
var itemShape = shapeHelper.Items_Content();
|
||||
var itemShape = _shapeHelperCalls.Invoke(shapeHelper, shapeTypeName);
|
||||
|
||||
itemShape.ContentItem = content.ContentItem;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user