mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 21:13:35 +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")))
|
if (!_services.Authorizer.Authorize(Permissions.ModifyPost, T("Couldn't edit blog post")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
bool isDraft = false;
|
||||||
|
|
||||||
//TODO: (erikpo) Move looking up the current blog up into a modelbinder
|
//TODO: (erikpo) Move looking up the current blog up into a modelbinder
|
||||||
Blog blog = _blogService.Get(blogSlug);
|
Blog blog = _blogService.Get(blogSlug);
|
||||||
|
|
||||||
@@ -150,8 +152,10 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
_blogPostService.Publish(post);
|
_blogPostService.Publish(post);
|
||||||
else if (publishDate != null)
|
else if (publishDate != null)
|
||||||
_blogPostService.Publish(post, publishDate.Value);
|
_blogPostService.Publish(post, publishDate.Value);
|
||||||
else
|
else {
|
||||||
|
isDraft = true;
|
||||||
_blogPostService.Unpublish(post);
|
_blogPostService.Unpublish(post);
|
||||||
|
}
|
||||||
|
|
||||||
var model = new BlogPostEditViewModel {
|
var model = new BlogPostEditViewModel {
|
||||||
BlogPost = _services.ContentManager.UpdateEditorModel(post, this)
|
BlogPost = _services.ContentManager.UpdateEditorModel(post, this)
|
||||||
@@ -167,7 +171,10 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
|
|
||||||
_services.Notifier.Information(T("Blog post information updated."));
|
_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]
|
[HttpPost]
|
||||||
|
Reference in New Issue
Block a user