mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Adding an "Edit" link for content on the front
--HG-- branch : dev
This commit is contained in:
@@ -5,6 +5,11 @@ namespace Orchard.Core.Contents {
|
|||||||
public class Shapes : IShapeTableProvider {
|
public class Shapes : IShapeTableProvider {
|
||||||
public void Discover(ShapeTableBuilder builder) {
|
public void Discover(ShapeTableBuilder builder) {
|
||||||
builder.Describe("Content")
|
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 => {
|
.OnDisplaying(displaying => {
|
||||||
ContentItem contentItem = displaying.Shape.ContentItem;
|
ContentItem contentItem = displaying.Shape.ContentItem;
|
||||||
if (contentItem != null) {
|
if (contentItem != null) {
|
||||||
|
|||||||
@@ -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)
|
||||||
|
}
|
||||||
@@ -394,6 +394,7 @@
|
|||||||
<Content Include="Dashboard\Views\Helper\Index.cshtml" />
|
<Content Include="Dashboard\Views\Helper\Index.cshtml" />
|
||||||
<None Include="Common\Placement.info" />
|
<None Include="Common\Placement.info" />
|
||||||
<None Include="Contents\Placement.info" />
|
<None Include="Contents\Placement.info" />
|
||||||
|
<None Include="Contents\Views\Content.ControlWrapper.cshtml" />
|
||||||
<None Include="Localization\Placement.info" />
|
<None Include="Localization\Placement.info" />
|
||||||
<None Include="PublishLater\Placement.info" />
|
<None Include="PublishLater\Placement.info" />
|
||||||
<None Include="Routable\Views\Parts\RoutableTitle.cshtml" />
|
<None Include="Routable\Views\Parts\RoutableTitle.cshtml" />
|
||||||
|
|||||||
Reference in New Issue
Block a user