mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
A bit more work getting content display in order
- content title added to the item shape (@Model.Title) - some rough content item shape structure - needs real body zones and footer (need header @ footer markup at least as zone wrappers in a way so if there is nothing in the zone the tags aren't rendered) - page title usage back in the picture though (impl.) not really touched - contents and routable display type actions all falling back to the core shaped "Display" view --HG-- branch : theming
This commit is contained in:
@@ -16,21 +16,20 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
// /Contents/Item/Display/72
|
||||
public ActionResult Display(int id) {
|
||||
var contentItem = _contentManager.Get(id, VersionOptions.Published);
|
||||
var model = _contentManager.BuildDisplayModel(contentItem, "Detail");
|
||||
return View(Shape.Model(model));
|
||||
var model = _contentManager.BuildDisplayModel(contentItem);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// /Contents/Item/Preview/72
|
||||
// /Contents/Item/Preview/72?version=5
|
||||
public ActionResult Preview(int id, int? version) {
|
||||
var versionOptions = VersionOptions.Latest;
|
||||
if (version != null) {
|
||||
if (version != null)
|
||||
versionOptions = VersionOptions.Number((int)version);
|
||||
}
|
||||
|
||||
var contentItem = _contentManager.Get(id, versionOptions);
|
||||
var model = _contentManager.BuildDisplayModel(contentItem, "Detail");
|
||||
return View(Shape.Model(model));
|
||||
var model = _contentManager.BuildDisplayModel(contentItem);
|
||||
return View("Display", model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
@Display(Model)
|
||||
@@ -1 +0,0 @@
|
||||
@Display(Model)
|
||||
@@ -1,8 +0,0 @@
|
||||
<article>
|
||||
<header>
|
||||
@Display(Model.Header)
|
||||
</header>
|
||||
<section>
|
||||
@Display(Model.primary)
|
||||
</section>
|
||||
</article>
|
||||
@@ -1,3 +1,8 @@
|
||||
content item -> @Model.ContentItem.ContentType
|
||||
|
||||
<article>
|
||||
<header>
|
||||
@Display(Model.Header)
|
||||
</header>
|
||||
<section>
|
||||
@Display(Model.primary)
|
||||
</section>
|
||||
</article>
|
||||
@@ -249,7 +249,9 @@
|
||||
<None Include="Common\Views\DisplayTemplates\Parts\Common.Metadata.SummaryAdmin.cshtml" />
|
||||
<Content Include="ContentsLocation\Module.txt" />
|
||||
<Content Include="ContentsLocation\Styles\admin.css" />
|
||||
<None Include="ContentsLocation\Views\DefinitionTemplates\LocationSettings.cshtml" />
|
||||
<Content Include="ContentsLocation\Views\DefinitionTemplates\LocationSettings.ascx" />
|
||||
<None Include="Contents\Views\Admin\Create.cshtml" />
|
||||
<None Include="Contents\Views\Admin\Edit.cshtml" />
|
||||
<None Include="Contents\Views\Admin\List.cshtml" />
|
||||
<Content Include="Localization\Views\EditorTemplates\Parts\Localization.Translation.ascx" />
|
||||
<Content Include="Messaging\Module.txt" />
|
||||
@@ -265,10 +267,7 @@
|
||||
<None Include="Common\Views\EditorTemplates\Parts\Common.Container.cshtml" />
|
||||
<None Include="Common\Views\EditorTemplates\PlainTextEditor.cshtml" />
|
||||
<Content Include="Contents\Module.txt" />
|
||||
<None Include="Contents\Views\Admin\Edit.cshtml" />
|
||||
<Content Include="Contents\Views\Admin\CreatableTypeList.ascx" />
|
||||
<None Include="Contents\Views\Admin\Create.cshtml" />
|
||||
<None Include="Contents\Views\Item\Preview.cshtml" />
|
||||
<Content Include="Localization\Styles\admin.css" />
|
||||
<Content Include="Localization\Styles\base.css" />
|
||||
<Content Include="Localization\Views\DisplayTemplates\Parts\Localization.ContentTranslations.Summary.ascx" />
|
||||
@@ -298,7 +297,6 @@
|
||||
<Content Include="PublishLater\Styles\ui.timepickr.css" />
|
||||
<Content Include="PublishLater\Views\EditorTemplates\Parts\PublishLater.ascx" />
|
||||
<Content Include="Reports\Module.txt" />
|
||||
<None Include="Contents\Views\Items\Content.Detail.cshtml" />
|
||||
<None Include="Reports\Views\Admin\Display.cshtml" />
|
||||
<None Include="Reports\Views\Admin\Index.cshtml" />
|
||||
<Content Include="Localization\Module.txt" />
|
||||
@@ -308,7 +306,6 @@
|
||||
<Content Include="Routable\Module.txt" />
|
||||
<Content Include="Routable\Scripts\jquery.slugify.js" />
|
||||
<None Include="Routable\Views\EditorTemplates\Parts\Routable.RoutePart.cshtml" />
|
||||
<None Include="Routable\Views\Item\Display.cshtml" />
|
||||
<None Include="Routable\Views\DisplayTemplates\Parts\Routable.RoutePart.cshtml" />
|
||||
<Content Include="Settings\Module.txt" />
|
||||
<Content Include="Settings\Styles\admin.css" />
|
||||
@@ -337,6 +334,7 @@
|
||||
<Content Include="Shapes\Views\UI\Switchable.ascx" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="XmlRpc\Module.txt" />
|
||||
<None Include="Shapes\Views\Display.cshtml" />
|
||||
<None Include="XmlRpc\Views\Home\Index.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -397,7 +395,6 @@
|
||||
<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\ContentZone.cshtml" />
|
||||
<None Include="Shapes\Views\DocumentZone.cshtml" />
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Orchard.Core.Routable.Controllers {
|
||||
throw new ApplicationException("Ambiguous content");
|
||||
}
|
||||
|
||||
var model = _contentManager.BuildDisplayModel<IRoutableAspect>(hits.Single(), "Detail");
|
||||
var model = _contentManager.BuildDisplayModel<IRoutableAspect>(hits.Single());
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace Orchard.Core.Routable.Handlers {
|
||||
routable.Path = routable.GetPathWithSlug(routable.Slug);
|
||||
});
|
||||
|
||||
OnGetDisplayShape<RoutePart>((context, routable) => context.Model.Title = routable.Title);
|
||||
|
||||
OnPublished<RoutePart>((context, routable) => {
|
||||
if (context.PublishingItemVersionRecord != null)
|
||||
processSlug(routable);
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
@//Html.AddTitleParts((string)Model.Routable.Item.Title);
|
||||
@Display(Model)
|
||||
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
Html.AddTitleParts((string)Model.Title);
|
||||
}
|
||||
@Display(Model)
|
||||
@@ -3,7 +3,7 @@
|
||||
<html lang="en" class="static @Html.ClassForPage()">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>@View.Page .Title</title>
|
||||
<title>@Html.Title(Html.SiteName())</title>
|
||||
@//could be a resource - at least need to get at the right location and this is something
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/modules/orchard.themes/Content/orchard.ico" />
|
||||
@{
|
||||
@@ -19,4 +19,4 @@
|
||||
@Display(Model.Body)
|
||||
@Display(Model.Tail)
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@@ -379,7 +379,7 @@ namespace Orchard.ContentManagement {
|
||||
new[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) }));
|
||||
|
||||
|
||||
public dynamic BuildDisplayModel<TContent>(TContent content, string displayType) where TContent : IContent {
|
||||
public dynamic BuildDisplayModel<TContent>(TContent content, string displayType = "") where TContent : IContent {
|
||||
var shapeHelper = _shapeHelperFactory.CreateHelper();
|
||||
|
||||
var shapeTypeName = string.IsNullOrEmpty(displayType) ? "Items_Content" : ("Items_Content_" + displayType);
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Orchard.ContentManagement {
|
||||
|
||||
ContentItemMetadata GetItemMetadata(IContent contentItem);
|
||||
|
||||
dynamic BuildDisplayModel<TContent>(TContent content, string displayType) where TContent : IContent;
|
||||
dynamic BuildDisplayModel<TContent>(TContent content, string displayType = "") where TContent : IContent;
|
||||
dynamic BuildEditorModel<TContent>(TContent content) where TContent : IContent;
|
||||
dynamic UpdateEditorModel<TContent>(TContent content, IUpdateModel updater) where TContent : IContent;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,7 @@ using Orchard.Settings;
|
||||
|
||||
namespace Orchard.Mvc.Html {
|
||||
public static class SiteServiceExtensions {
|
||||
public static string SiteName(this HtmlHelper html)
|
||||
{
|
||||
public static string SiteName(this HtmlHelper html) {
|
||||
return html.Resolve<ISiteService>().GetSiteSettings().SiteName;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -8,14 +8,14 @@ WorkContext.Page == Layout shape
|
||||
|
||||
Document [:Layout]
|
||||
|
||||
Layout (.Wrappers[Document])
|
||||
Layout (Body) (.Wrappers[Document])
|
||||
.Zones (meta-property)
|
||||
.Title
|
||||
|
||||
Zone
|
||||
.ZoneName
|
||||
|
||||
Menu
|
||||
Menu (in Body.Navigation)
|
||||
.MenuName
|
||||
|
||||
MenuItem
|
||||
@@ -32,9 +32,10 @@ List: ul|ol + li*
|
||||
.ItemClasses
|
||||
.ItemAttributes
|
||||
|
||||
Items_Content
|
||||
Items_Content (a single content item)
|
||||
.Zones (meta-property)
|
||||
.ContentItem (clr object)
|
||||
.Title (from Orchard.Core.Routable(.Handlers.RoutePartHandler))
|
||||
|
||||
PlaceChildContent
|
||||
.Source (another shape, presumed rendered)
|
||||
|
||||
Reference in New Issue
Block a user