mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Adding a couple of widget wrappers including a manage version w/ edit link
--HG-- branch : dev
This commit is contained in:
@@ -260,7 +260,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
public ActionResult EditPOST(int id) {
|
||||
public ActionResult EditPOST(int id, string returnUrl) {
|
||||
var contentItem = _contentManager.Get(id, VersionOptions.DraftRequired);
|
||||
|
||||
if (contentItem == null)
|
||||
@@ -282,6 +282,10 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
Services.Notifier.Information(string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)
|
||||
? T("Your content has been saved.")
|
||||
: T("Your {0} has been saved.", contentItem.TypeDefinition.DisplayName));
|
||||
|
||||
if (!String.IsNullOrEmpty(returnUrl))
|
||||
return Redirect(returnUrl);
|
||||
|
||||
return RedirectToAction("Edit", new RouteValueDictionary { { "Id", contentItem.Id } });
|
||||
}
|
||||
|
||||
|
@@ -115,11 +115,13 @@
|
||||
<None Include="Views\Admin\EditLayer.cshtml" />
|
||||
<None Include="Views\Admin\Index.cshtml" />
|
||||
<Content Include="Views\Items_Widget.Editor.cshtml" />
|
||||
<None Include="Views\Widget.Manage.cshtml" />
|
||||
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetPart.cshtml" />
|
||||
<None Include="Views\EditorTemplates\Parts\Widgets.LayerPart.cshtml" />
|
||||
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetBagPart.cshtml" />
|
||||
<Content Include="Views\Items_Widget.cshtml" />
|
||||
<Content Include="Views\Items\Content-WidgetPage.cshtml" />
|
||||
<None Include="Views\Widget.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
@@ -4,8 +4,24 @@ using Orchard.Widgets.Models;
|
||||
|
||||
namespace Orchard.Widgets {
|
||||
public class Shapes : IShapeTableProvider {
|
||||
private readonly IOrchardServices _orchardServices;
|
||||
|
||||
public Shapes(IOrchardServices orchardServices) {
|
||||
_orchardServices = orchardServices;
|
||||
}
|
||||
|
||||
public void Discover(ShapeTableBuilder builder) {
|
||||
builder.Describe("Items_Widget")
|
||||
.Configure(descriptor => {
|
||||
if (_orchardServices.Authorizer.Authorize(Permissions.ManageWidgets))
|
||||
descriptor.Wrappers.Add("Widget_Manage");
|
||||
else
|
||||
descriptor.Wrappers.Add("Widget");
|
||||
})
|
||||
.OnCreated(created => {
|
||||
var widget = created.Shape;
|
||||
widget.Main.Add(created.New.PlaceChildContent(Source: widget));
|
||||
})
|
||||
.OnDisplaying(displaying => {
|
||||
ContentItem contentItem = displaying.Shape.ContentItem;
|
||||
if (contentItem != null) {
|
||||
|
@@ -0,0 +1,5 @@
|
||||
@using Orchard.ContentManagement;
|
||||
<div class="widget widget-manage">
|
||||
<div class="actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
|
||||
@Display(Model.Main)
|
||||
</div>
|
@@ -0,0 +1 @@
|
||||
@Display(Model.Main)
|
Reference in New Issue
Block a user