- 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:
suhacan
2010-01-19 19:52:08 +00:00
parent f4c22d37ee
commit 7170b74f6c

View File

@@ -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]