#17426: Content item with Container part renders without other parts

--HG--
branch : 1.x
This commit is contained in:
Dave Reed
2011-05-25 12:06:19 -07:00
parent f10f1215e6
commit ab71f4cc7f
4 changed files with 17 additions and 19 deletions

View File

@@ -7,6 +7,7 @@ using Orchard.Core.Containers.Extensions;
using Orchard.Core.Containers.Models;
using Orchard.Core.Routable.Models;
using Orchard.DisplayManagement;
using Orchard.Mvc;
using Orchard.Themes;
using Orchard.UI.Navigation;
using Orchard.Settings;
@@ -71,14 +72,16 @@ namespace Orchard.Core.Containers.Controllers {
var list = Shape.List();
list.AddRange(pageOfItems.Select(item => _contentManager.BuildDisplay(item, "Summary")));
list.Classes.Add("content-items");
list.Classes.Add("list-items");
dynamic viewModel = Shape.ViewModel()
.ContentItems(list)
.Pager(pagerShape)
.ShowPager(container.As<ContainerPart>().Record.Paginated);
var model = _contentManager.BuildDisplay(container, "Detail");
model.Content.Add(list, "5");
if (container.As<ContainerPart>().Record.Paginated) {
model.Content.Add(pagerShape, "5.1");
}
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
return View((object)viewModel);
return new ShapeResult(this, model);
}
}
}

View File

@@ -1,9 +0,0 @@
@{
IEnumerable<object> items = Model.ContentItems;
Model.ContentItems.Classes.Add("content-items");
Model.ContentItems.Classes.Add("list-items");
}
@Display(items)
@if (Model.ShowPager) {
@Display(Model.Pager)
}

View File

@@ -385,7 +385,6 @@
<Content Include="Containers\Placement.info" />
<Content Include="Containers\Views\EditorTemplates\ContainerWidget.cshtml" />
<Content Include="Containers\Views\EditorTemplates\Container.cshtml" />
<Content Include="Containers\Views\Item\Display.cshtml" />
<Content Include="Containers\Views\DefinitionTemplates\ContainerPartSettings.cshtml" />
<Content Include="Containers\Views\DefinitionTemplates\ContainerTypePartSettings.cshtml" />
<Content Include="Containers\Views\EditorTemplates\Containable.cshtml" />

View File

@@ -3,7 +3,12 @@
<!--
Parts_Container_Contained_SummaryAdmin
-->
<Match DisplayType="SummaryAdmin">
<Place Parts_Container_Contained_SummaryAdmin="Actions:10"/>
</Match>
<Match ContentType="List" DisplayType="Detail">
<!-- don't show the List title or Common Metadata -->
<Place Parts_RoutableTitle="-" />
<Place Parts_Common_Metadata="-" />
</Match>
<Match DisplayType="SummaryAdmin">
<Place Parts_Container_Contained_SummaryAdmin="Actions:10"/>
</Match>
</Placement>