Adding an "Edit" link for content on the front

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-10-15 16:49:19 -07:00
parent 7eaef1ecf6
commit 816c1a1ff5
3 changed files with 17 additions and 0 deletions

View File

@@ -5,6 +5,11 @@ 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));
})
.OnDisplaying(displaying => {
ContentItem contentItem = displaying.Shape.ContentItem;
if (contentItem != null) {

View File

@@ -0,0 +1,11 @@
@using Orchard.ContentManagement;
@using Orchard.Core.Contents;
@if (AuthorizedFor(Permissions.EditContent)) {
<div class="content-control">
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
@Display(Model.Main)
</div>
}
else {
@Display(Model.Main)
}

View File

@@ -394,6 +394,7 @@
<Content Include="Dashboard\Views\Helper\Index.cshtml" />
<None Include="Common\Placement.info" />
<None Include="Contents\Placement.info" />
<None Include="Contents\Views\Content.ControlWrapper.cshtml" />
<None Include="Localization\Placement.info" />
<None Include="PublishLater\Placement.info" />
<None Include="Routable\Views\Parts\RoutableTitle.cshtml" />