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:
Louis DeJardin
2010-09-09 19:23:06 -07:00
parent a03da9496a
commit 88535ed8c6
13 changed files with 76 additions and 15 deletions

View File

@@ -1,3 +1,3 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BodyDisplayViewModel>" %> <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BodyDisplayViewModel>" %>
<%@ Import Namespace="Orchard.Core.Common.ViewModels"%> <%@ Import Namespace="Orchard.Core.Common.ViewModels"%>
<%=Model.Text %> <%:Model.Html %>

View File

@@ -117,8 +117,13 @@ namespace Orchard.Core.Contents.Controllers {
var list = Shape.List(); var list = Shape.List();
list.AddRange(contentItems); list.AddRange(contentItems);
var list2 = Shape.List();
var items = contentItems.Select(ci=>_contentManager.BuildDisplayModel(ci, "SummaryAdmin"));
list2.AddRange(items);
var viewModel = Shape.ViewModel() var viewModel = Shape.ViewModel()
.ContentItems(list) .ContentItems(list)
.ContentItems2(list2)
.Options(model.Options) .Options(model.Options)
.TypeDisplayName(model.TypeDisplayName ?? ""); .TypeDisplayName(model.TypeDisplayName ?? "");

View 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) {
}
}
}

View File

@@ -1,5 +1,6 @@
@using Orchard.Core.Contents.ViewModels @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"> <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" }) @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> </div>
@@ -31,5 +32,6 @@
</fieldset> </fieldset>
<fieldset class="contentItems bulk-items"> <fieldset class="contentItems bulk-items">
@Display(Model.ContentItems) @Display(Model.ContentItems)
@Display(Model.ContentItems2)
</fieldset> </fieldset>
} }

View File

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

View File

@@ -21,7 +21,7 @@ namespace Orchard.Core.Dashboard.Controllers {
var list = shape.List(); var list = shape.List();
list.Add(_contentManager.BuildDisplayModel(CurrentUser, "Detail")); list.Add(_contentManager.BuildDisplayModel(CurrentUser, ""));
foreach (var contentItem in _contentManager.Query().Join<BodyPartRecord>().List()) { foreach (var contentItem in _contentManager.Query().Join<BodyPartRecord>().List()) {
list.Add(_contentManager.BuildDisplayModel(contentItem, "Summary")); list.Add(_contentManager.BuildDisplayModel(contentItem, "Summary"));
} }

View File

@@ -88,6 +88,7 @@
<Compile Include="Contents\Routes.cs" /> <Compile Include="Contents\Routes.cs" />
<Compile Include="Contents\Settings\ContentTypeSettings.cs" /> <Compile Include="Contents\Settings\ContentTypeSettings.cs" />
<Compile Include="Contents\Settings\ContentPartSettings.cs" /> <Compile Include="Contents\Settings\ContentPartSettings.cs" />
<Compile Include="Contents\Shapes.cs" />
<Compile Include="Contents\ViewModels\PublishContentViewModel.cs" /> <Compile Include="Contents\ViewModels\PublishContentViewModel.cs" />
<Compile Include="Localization\ViewModels\EditLocalizationViewModel.cs" /> <Compile Include="Localization\ViewModels\EditLocalizationViewModel.cs" />
<Compile Include="Messaging\DataMigrations\MessagingDataMigration.cs" /> <Compile Include="Messaging\DataMigrations\MessagingDataMigration.cs" />
@@ -402,6 +403,7 @@
<None Include="Contents\Views\Items\Content.cshtml" /> <None Include="Contents\Views\Items\Content.cshtml" />
<None Include="Contents\Views\Items\Content.Edit.cshtml" /> <None Include="Contents\Views\Items\Content.Edit.cshtml" />
<None Include="Contents\Views\Items\Content.Summary.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="Contents\Views\Item\Display.cshtml" />
<None Include="HomePage\Views\HomePage.cshtml" /> <None Include="HomePage\Views\HomePage.cshtml" />
<None Include="Shapes\Views\Document.cshtml" /> <None Include="Shapes\Views\Document.cshtml" />

View File

@@ -1,6 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Web; using System.Web;
@@ -8,7 +6,6 @@ using System.Web.Mvc;
using System.Web.Mvc.Html; using System.Web.Mvc.Html;
using Orchard.DisplayManagement; using Orchard.DisplayManagement;
using Orchard.DisplayManagement.Descriptors; using Orchard.DisplayManagement.Descriptors;
using Orchard.DisplayManagement.Shapes;
using Orchard.Environment.Extensions.Models; using Orchard.Environment.Extensions.Models;
using Orchard.UI; using Orchard.UI;
using Orchard.UI.Zones; using Orchard.UI.Zones;
@@ -30,9 +27,6 @@ namespace Orchard.Core.Shapes {
created.Shape.Zones.Body.Add(created.New.PlaceChildContent(Source: created.Shape), "5"); 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 // 'Zone' shapes are built on the Zone base class
builder.Describe.Named("Zone").From(Feature.Descriptor) builder.Describe.Named("Zone").From(Feature.Descriptor)
.OnCreating(creating => creating.BaseType = typeof(Zone)); .OnCreating(creating => creating.BaseType = typeof(Zone));

View File

@@ -12,6 +12,7 @@
} }
@//Model.Zones.AddRenderPartial("head:before", "HeadPreload", Model); @//Model.Zones.AddRenderPartial("head:before", "HeadPreload", Model);
@//Html.Zone("head", ":metas :styles :scripts"); %> @//Html.Zone("head", ":metas :styles :scripts"); %>
@Display(Model.Head)
<script>(function(d){d.className="dyn "+d.className.substring(7,d.length);})(document.documentElement);</script> <script>(function(d){d.className="dyn "+d.className.substring(7,d.length);})(document.documentElement);</script>
</head> </head>
<body> <body>

View File

@@ -88,6 +88,7 @@
<Content Include="ScaffoldingTemplates\DataMigration.txt" /> <Content Include="ScaffoldingTemplates\DataMigration.txt" />
<Compile Include="Services\ScaffoldingCommandInterpreter.cs" /> <Compile Include="Services\ScaffoldingCommandInterpreter.cs" />
<Compile Include="Settings\DevToolsSettings.cs" /> <Compile Include="Settings\DevToolsSettings.cs" />
<Compile Include="Shapes.cs" />
<Compile Include="ViewModels\CommandsExecuteViewModel.cs" /> <Compile Include="ViewModels\CommandsExecuteViewModel.cs" />
<Compile Include="ViewModels\ContentIndexViewModel.cs" /> <Compile Include="ViewModels\ContentIndexViewModel.cs" />
<Compile Include="ViewModels\ContentDetailsViewModel.cs" /> <Compile Include="ViewModels\ContentDetailsViewModel.cs" />
@@ -126,6 +127,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Views\ThinBorder.cshtml" />
<None Include="Views\Home\FormShapes.cshtml" /> <None Include="Views\Home\FormShapes.cshtml" />
<None Include="Views\Home\UsingShapes.cshtml" /> <None Include="Views\Home\UsingShapes.cshtml" />
<None Include="Views\Inventory\ShapeTable.cshtml" /> <None Include="Views\Inventory\ShapeTable.cshtml" />

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

View File

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

View File

@@ -383,8 +383,7 @@ namespace Orchard.ContentManagement {
var shapeHelper = _shapeHelperFactory.CreateHelper(); var shapeHelper = _shapeHelperFactory.CreateHelper();
var shapeTypeName = string.IsNullOrEmpty(displayType) ? "Items_Content" : ("Items_Content_" + displayType); var shapeTypeName = string.IsNullOrEmpty(displayType) ? "Items_Content" : ("Items_Content_" + displayType);
_shapeHelperCalls.Invoke(shapeHelper, shapeTypeName); var itemShape = _shapeHelperCalls.Invoke(shapeHelper, shapeTypeName);
var itemShape = shapeHelper.Items_Content();
itemShape.ContentItem = content.ContentItem; itemShape.ContentItem = content.ContentItem;