Making the content wrapper not apply to *Admin* display types and making the wrapper zone names containing the child contents consistent (Model.Child)

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-10-15 17:10:34 -07:00
parent 6da2e04ada
commit b53a96d83f
5 changed files with 10 additions and 8 deletions

View File

@@ -5,10 +5,9 @@ namespace Orchard.Core.Contents {
public class Shapes : IShapeTableProvider {
public void Discover(ShapeTableBuilder builder) {
builder.Describe("Content")
.Configure(descriptor => descriptor.Wrappers.Add("Content_ControlWrapper"))
.OnCreated(created => {
var content = created.Shape;
content.Main.Add(created.New.PlaceChildContent(Source: content));
content.Child.Add(created.New.PlaceChildContent(Source: content));
})
.OnDisplaying(displaying => {
ContentItem contentItem = displaying.Shape.ContentItem;
@@ -21,6 +20,9 @@ namespace Orchard.Core.Contents {
displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType);
//Content.Summary-Page
displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType + "__" + contentItem.ContentType);
if (!displaying.ShapeMetadata.DisplayType.Contains("Admin"))
displaying.ShapeMetadata.Wrappers.Add("Content_ControlWrapper");
}
});

View File

@@ -3,9 +3,9 @@
@if (AuthorizedFor(Permissions.EditContent)) {
<div class="content-control">
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
@Display(Model.Main)
@Display(Model.Child)
</div>
}
else {
@Display(Model.Main)
@Display(Model.Child)
}

View File

@@ -14,7 +14,7 @@ namespace Orchard.Widgets {
})
.OnCreated(created => {
var widget = created.Shape;
widget.Main.Add(created.New.PlaceChildContent(Source: widget));
widget.Child.Add(created.New.PlaceChildContent(Source: widget));
})
.OnDisplaying(displaying => {
ContentItem contentItem = displaying.Shape.ContentItem;

View File

@@ -3,9 +3,9 @@
@if (AuthorizedFor(Permissions.ManageWidgets)) {
<div class="widget-control">
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
@Display(Model.Main)
@Display(Model.Child)
</div>
}
else {
@Display(Model.Main)
@Display(Model.Child)
}

View File

@@ -8,7 +8,7 @@
<h1>@title</h1>
@Display(Model.Header)
</header>
@Display.PlaceChildContent(Source: Model)
@Display(Model.Child)
@if(Model.Footer != null) {
<footer>
@Display(Model.Footer)