mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
- Blogs: When saving a draft post, should redirect to/Edit admin URL for that post
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045708
This commit is contained in:
@@ -122,6 +122,8 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (!_services.Authorizer.Authorize(Permissions.ModifyPost, T("Couldn't edit blog post")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
bool isDraft = false;
|
||||
|
||||
//TODO: (erikpo) Move looking up the current blog up into a modelbinder
|
||||
Blog blog = _blogService.Get(blogSlug);
|
||||
|
||||
@@ -150,8 +152,10 @@ namespace Orchard.Blogs.Controllers {
|
||||
_blogPostService.Publish(post);
|
||||
else if (publishDate != null)
|
||||
_blogPostService.Publish(post, publishDate.Value);
|
||||
else
|
||||
else {
|
||||
isDraft = true;
|
||||
_blogPostService.Unpublish(post);
|
||||
}
|
||||
|
||||
var model = new BlogPostEditViewModel {
|
||||
BlogPost = _services.ContentManager.UpdateEditorModel(post, this)
|
||||
@@ -167,7 +171,10 @@ namespace Orchard.Blogs.Controllers {
|
||||
|
||||
_services.Notifier.Information(T("Blog post information updated."));
|
||||
|
||||
return Redirect(Url.BlogForAdmin(blogSlug));
|
||||
if (isDraft) {
|
||||
return Redirect(Url.BlogPostEdit(blog.Slug, post.Slug));
|
||||
}
|
||||
return Redirect(Url.BlogForAdmin(blog.Slug));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
Reference in New Issue
Block a user