mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Add a FollowReturnUrl attribute to honor ReturnUrl in the querystring
--HG-- branch : dev
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BodyDisplayViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Common.ViewModels"%>
|
||||
<div class="manage">
|
||||
<%=Html.ItemEditLink("Edit", Model.BodyAspect.ContentItem) %>
|
||||
<%=Html.ItemEditLinkWithReturnUrl(_Encoded("Edit").ToString(), Model.BodyAspect.ContentItem) %>
|
||||
</div>
|
@@ -7,6 +7,7 @@ using Orchard.Blogs.ViewModels;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc.AntiForgery;
|
||||
using Orchard.Mvc.FollowReturnUrl;
|
||||
using Orchard.Mvc.Results;
|
||||
using Orchard.UI.Admin;
|
||||
using Orchard.UI.Notify;
|
||||
@@ -100,17 +101,17 @@ namespace Orchard.Blogs.Controllers {
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
[HttpPost, ActionName("Edit"), FollowReturnUrl]
|
||||
public ActionResult EditPOST(string blogSlug, int postId) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditBlogPost, T("Couldn't edit blog post")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
Blog blog = _blogService.Get(blogSlug);
|
||||
var blog = _blogService.Get(blogSlug);
|
||||
if (blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
// Get draft (create a new version if needed)
|
||||
BlogPost post = _blogPostService.Get(postId, VersionOptions.DraftRequired);
|
||||
var post = _blogPostService.Get(postId, VersionOptions.DraftRequired);
|
||||
if (post == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
|
@@ -7,6 +7,7 @@ using JetBrains.Annotations;
|
||||
using Orchard.Localization;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Mvc.AntiForgery;
|
||||
using Orchard.Mvc.FollowReturnUrl;
|
||||
using Orchard.Mvc.Results;
|
||||
using Orchard.Pages.Drivers;
|
||||
using Orchard.Pages.Models;
|
||||
@@ -169,9 +170,9 @@ namespace Orchard.Pages.Controllers {
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
[HttpPost, ActionName("Edit"), FollowReturnUrl]
|
||||
public ActionResult EditPOST(int id) {
|
||||
Page page = _pageService.GetPageOrDraft(id);
|
||||
var page = _pageService.GetPageOrDraft(id);
|
||||
if (page == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
@@ -209,7 +210,7 @@ namespace Orchard.Pages.Controllers {
|
||||
break;
|
||||
}
|
||||
|
||||
return RedirectToAction("Edit", "Admin", new { id = model.Page.Item.ContentItem.Id });
|
||||
return RedirectToAction("Edit", "Admin", new {id = model.Page.Item.ContentItem.Id});
|
||||
}
|
||||
|
||||
public ActionResult DiscardDraft(int id) {
|
||||
|
Reference in New Issue
Block a user