mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Fixed content publishing on creation
--HG-- branch : dev
This commit is contained in:
@@ -110,6 +110,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
public ActionResult Create(CreateItemViewModel model) {
|
||||
//todo: need to integrate permissions into generic content management
|
||||
var contentItem = _contentManager.New(model.Id);
|
||||
_contentManager.Create(contentItem, VersionOptions.Draft);
|
||||
model.Content = _contentManager.UpdateEditorModel(contentItem, this);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
@@ -118,13 +119,11 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
return View("Create", model);
|
||||
}
|
||||
|
||||
_contentManager.Create(contentItem, VersionOptions.Draft);
|
||||
|
||||
//need to go about this differently - to know when to publish (IPlublishableAspect ?)
|
||||
if (!contentItem.Has<IPublishingControlAspect>())
|
||||
if (!contentItem.Has<IPublishingControlAspect>()) {
|
||||
_contentManager.Publish(contentItem);
|
||||
_notifier.Information(T("Created content item"));
|
||||
}
|
||||
|
||||
_notifier.Information(T("Created content item"));
|
||||
return RedirectToAction("Edit", new RouteValueDictionary { { "Id", contentItem.Id } });
|
||||
}
|
||||
|
||||
|
@@ -53,6 +53,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (blogPost.Blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
Services.ContentManager.Create(blogPost, VersionOptions.Draft);
|
||||
model.BlogPost = Services.ContentManager.UpdateEditorModel(blogPost, this);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
@@ -60,9 +61,6 @@ namespace Orchard.Blogs.Controllers {
|
||||
return View(model);
|
||||
}
|
||||
|
||||
Services.ContentManager.Create(model.BlogPost.Item.ContentItem, VersionOptions.Draft);
|
||||
Services.ContentManager.UpdateEditorModel(blogPost, this);
|
||||
|
||||
return Redirect(Url.BlogPostEdit(model.BlogPost.Item));
|
||||
}
|
||||
|
||||
|
@@ -82,7 +82,6 @@ namespace Orchard.Blogs.Drivers {
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(BlogPost post, IUpdateModel updater) {
|
||||
updater.TryUpdateModel(post, Prefix, null, null);
|
||||
return Editor(post);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user