Getting Orchard.Blogs on the new UI composition model (for display)

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-10-15 14:40:35 -07:00
parent 4fa953c150
commit 262f4a4559
19 changed files with 143 additions and 104 deletions

View File

@@ -6,7 +6,7 @@ using System.Xml.Linq;
using Orchard.Blogs.Models;
using Orchard.Blogs.Routing;
using Orchard.Blogs.Services;
using Orchard.Blogs.ViewModels;
using Orchard.ContentManagement;
using Orchard.DisplayManagement;
using Orchard.Logging;
using Orchard.Themes;
@@ -53,25 +53,27 @@ namespace Orchard.Blogs.Controllers {
if (correctedSlug == null)
return HttpNotFound();
BlogPart blog = _blogService.Get(correctedSlug);
if (blog == null)
var blogPart = _blogService.Get(correctedSlug);
if (blogPart == null)
return HttpNotFound();
var blogPosts = _blogPostService.Get(blog, (page - 1)*pageSize, pageSize).Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));
var blogPosts = _blogPostService.Get(blogPart, (page - 1) * pageSize, pageSize)
.Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));
blogPart.As<BlogPagerPart>().Page = page;
blogPart.As<BlogPagerPart>().PageSize = pageSize;
blogPart.As<BlogPagerPart>().BlogSlug = correctedSlug;
blogPart.As<BlogPagerPart>().ThereIsANextPage = _blogPostService.Get(blogPart, (page) * pageSize, pageSize).Any();
var blog = _services.ContentManager.BuildDisplay(blogPart);
var list = Shape.List();
list.AddRange(blogPosts);
var blogShape = _services.ContentManager.BuildDisplay(blog);
var model = new DisplayBlogViewModel {
Blog = blogShape,
BlogPostList = list,
Page = page,
PageSize = pageSize
};
return View(model);
blog.ContentItem = blogPart;
blog.Content.Add(Shape.Parts_Blogs_BlogPost_List(ContentItems: list), "5");
return View("Display", blog);
}
public ActionResult LiveWriterManifest(string blogSlug) {