Cleaning page class names

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2013-04-24 12:05:26 -07:00
parent 2da17672ca
commit 6f8620d03f
8 changed files with 24 additions and 22 deletions

View File

@@ -33,7 +33,7 @@ namespace Orchard.Core.Contents.Controllers {
}
dynamic model = _contentManager.BuildDisplay(contentItem);
return new ShapeResult(this, model);
return View((object)model);
}
// /Contents/Item/Preview/72
@@ -57,7 +57,7 @@ namespace Orchard.Core.Contents.Controllers {
}
dynamic model = _contentManager.BuildDisplay(contentItem);
return new ShapeResult(this, model);
return View((object)model);
}
}
}

View File

@@ -0,0 +1,6 @@
@using Orchard.ContentManagement
@using Orchard.Utility.Extensions
@{
ContentItem contentItem = Model.ContentItem;
Html.AddPageClassNames("detail-" + contentItem.ContentType.HtmlClassify());
}@Display(Model)

View File

@@ -0,0 +1,6 @@
@using Orchard.ContentManagement
@using Orchard.Utility.Extensions
@{
ContentItem contentItem = Model.ContentItem;
Html.AddPageClassNames("preview", "detail-" + contentItem.ContentType.HtmlClassify());
}@Display(Model)

View File

@@ -550,6 +550,12 @@
<ItemGroup>
<Content Include="Contents\Views\Parts.Contents.Clone.SummaryAdmin.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Contents\Views\Item\Display.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Contents\Views\Item\Preview.cshtml" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@@ -114,9 +114,6 @@
<ItemGroup>
<Content Include="Views\Item\Create.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Item\Edit.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Parts.CustomForm.Edit.cshtml" />
</ItemGroup>

View File

@@ -1,8 +1,11 @@
@using Orchard.ContentManagement
@using Orchard.Utility.Extensions
@{
ContentItem customForm = Model.ContentItem;
string returnUrl = Model.ReturnUrl;
Html.AddPageClassNames("edit-" + customForm.ContentType.HtmlClassify());
// remove default Save/Publish buttons
Model.Zones["Sidebar"].Items.Clear();
}

View File

@@ -1,5 +0,0 @@
@using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
@Display(Model)
}

View File

@@ -7,13 +7,10 @@ using Orchard.DisplayManagement;
using Orchard.DisplayManagement.Descriptors;
using Orchard.FileSystems.VirtualPath;
using Orchard.Logging;
using Orchard.UI.PageClass;
using Orchard.UI.Zones;
using Orchard.Utility.Extensions;
namespace Orchard.ContentManagement {
public class DefaultContentDisplay : IContentDisplay {
private readonly IPageClassBuilder _pageClassBuilder;
private readonly Lazy<IEnumerable<IContentHandler>> _handlers;
private readonly IShapeFactory _shapeFactory;
private readonly Lazy<IShapeTableLocator> _shapeTableLocator;
@@ -23,14 +20,12 @@ namespace Orchard.ContentManagement {
private readonly IWorkContextAccessor _workContextAccessor;
public DefaultContentDisplay(
IPageClassBuilder pageClassBuilder,
Lazy<IEnumerable<IContentHandler>> handlers,
IShapeFactory shapeFactory,
Lazy<IShapeTableLocator> shapeTableLocator,
RequestContext requestContext,
IVirtualPathProvider virtualPathProvider,
IWorkContextAccessor workContextAccessor) {
_pageClassBuilder = pageClassBuilder;
_handlers = handlers;
_shapeFactory = shapeFactory;
_shapeTableLocator = shapeTableLocator;
@@ -52,10 +47,6 @@ namespace Orchard.ContentManagement {
var actualShapeType = stereotype;
var actualDisplayType = string.IsNullOrWhiteSpace(displayType) ? "Detail" : displayType;
if (actualDisplayType == "Detail") {
_pageClassBuilder.AddClassNames("detail-" + content.ContentItem.ContentType.HtmlClassify());
}
dynamic itemShape = CreateItemShape(actualShapeType);
itemShape.ContentItem = content.ContentItem;
itemShape.Metadata.DisplayType = actualDisplayType;
@@ -77,7 +68,6 @@ namespace Orchard.ContentManagement {
stereotype = "Content";
var actualShapeType = stereotype + "_Edit";
_pageClassBuilder.AddClassNames("edit-" + content.ContentItem.ContentType.HtmlClassify());
dynamic itemShape = CreateItemShape(actualShapeType);
itemShape.ContentItem = content.ContentItem;
@@ -101,7 +91,6 @@ namespace Orchard.ContentManagement {
stereotype = "Content";
var actualShapeType = stereotype + "_Edit";
_pageClassBuilder.AddClassNames("edit-" + content.ContentItem.ContentType.HtmlClassify());
dynamic itemShape = CreateItemShape(actualShapeType);
itemShape.ContentItem = content.ContentItem;