Some work on (blog and blogpost) slug generation

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045497
This commit is contained in:
skewed
2010-01-15 23:44:22 +00:00
parent 88924471b7
commit ee7ed66480
11 changed files with 121 additions and 33 deletions

View File

@@ -75,13 +75,10 @@ namespace Orchard.Blogs.Controllers {
}
//TODO: (erikpo) Evaluate if publish options should be moved into create or out of create to keep it clean
BlogPost blogPost = _services.ContentManager.Create<BlogPost>("blogpost", publishNow ? VersionOptions.Published : VersionOptions.Draft,
bp => {
bp.Blog = blog;
if (!publishNow && publishDate != null)
bp.Published = publishDate.Value;
});
model.BlogPost = _services.ContentManager.UpdateEditorModel(blogPost, this);
model.BlogPost = _services.ContentManager.UpdateEditorModel(_services.ContentManager.New<BlogPost>("blogpost"), this);
model.BlogPost.Item.Blog = blog;
if (!publishNow && publishDate != null)
model.BlogPost.Item.Published = publishDate.Value;
if (!ModelState.IsValid) {
_services.TransactionManager.Cancel();
@@ -89,6 +86,8 @@ namespace Orchard.Blogs.Controllers {
return View(model);
}
_services.ContentManager.Create(model.BlogPost.Item.ContentItem, publishNow ? VersionOptions.Published : VersionOptions.Draft);
//TEMP: (erikpo) ensure information has committed for this record
var session = _sessionLocator.For(typeof(ContentItemRecord));
session.Flush();