mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
Changed (front end) blogs list page to use new templating methods.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4043457
This commit is contained in:
@@ -39,7 +39,10 @@ namespace Orchard.Blogs.Controllers {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public ActionResult List() {
|
||||
return View(new BlogsViewModel { Blogs = _blogService.Get() });
|
||||
IEnumerable<ItemDisplayViewModel<Blog>> blogs =
|
||||
_blogService.Get().Select(b => _contentManager.GetDisplayViewModel(b, null, "Summary"));
|
||||
|
||||
return View(new BlogsViewModel {Blogs = blogs});
|
||||
}
|
||||
|
||||
public ActionResult ListForAdmin() {
|
||||
@@ -50,12 +53,9 @@ namespace Orchard.Blogs.Controllers {
|
||||
public ActionResult Item(string blogSlug) {
|
||||
Blog blog = _blogService.Get(blogSlug);
|
||||
|
||||
|
||||
if (blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
// var posts = _blogPostService.Get(blog).Select(bp => _contentManager.GetDisplayViewModel(bp, null, "Summary"));
|
||||
|
||||
return View(new BlogViewModel {
|
||||
Blog = _contentManager.GetDisplayViewModel(blog, null, "Detail")
|
||||
});
|
||||
|
@@ -15,7 +15,7 @@ namespace Orchard.Blogs.Models {
|
||||
Filters.Add(new ActivatingFilter<CommonAspect>("blog"));
|
||||
Filters.Add(new ActivatingFilter<RoutableAspect>("blog"));
|
||||
Filters.Add(new StorageFilter<BlogRecord>(repository));
|
||||
Filters.Add(new ContentItemTemplates<Blog>("Blog"));
|
||||
Filters.Add(new ContentItemTemplates<Blog>("Blog", "Summary"));
|
||||
}
|
||||
}
|
||||
}
|
@@ -113,15 +113,14 @@
|
||||
<Content Include="Views\Models\DisplayTemplates\BlogPostSummary.ascx" />
|
||||
<Content Include="Views\Models\DisplayTemplates\Blog.ascx" />
|
||||
<Content Include="Views\Models\DisplayTemplates\BlogPostList.ascx" />
|
||||
<Content Include="Views\Models\DisplayTemplates\BlogSummary.ascx" />
|
||||
<Content Include="Views\Shared\BlogPostPreview.ascx" />
|
||||
<Content Include="Views\BlogPost\EditorTemplates\CreateBlogPostViewModel.ascx" />
|
||||
<Content Include="Views\BlogPost\Item.aspx" />
|
||||
<Content Include="Views\Blog\Create.aspx" />
|
||||
<Content Include="Views\Blog\DisplayTemplates\_Blog.ascx" />
|
||||
<Content Include="Views\Blog\Edit.aspx" />
|
||||
<Content Include="Views\Blog\EditorTemplates\BlogEditViewModel.ascx" />
|
||||
<Content Include="Views\Blog\EditorTemplates\BlogPermalink.ascx" />
|
||||
<Content Include="Views\Blog\DisplayTemplates\BlogsViewModel.ascx" />
|
||||
<Content Include="Views\Blog\EditorTemplates\CreateBlogViewModel.ascx" />
|
||||
<Content Include="Views\Blog\Item.aspx" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\BlogPostPreviewForAdmin.ascx" />
|
||||
|
@@ -1,9 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Models.ViewModels;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class BlogsViewModel : BaseViewModel {
|
||||
public IEnumerable<Blog> Blogs { get; set; }
|
||||
public IEnumerable<ItemDisplayViewModel<Blog>> Blogs { get; set; }
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BlogsViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"
|
||||
%><%
|
||||
if (Model.Blogs.Count() > 0) { %>
|
||||
<%=Html.UnorderedList(Model.Blogs, (b, i) => Html.DisplayFor(blog => b).ToHtmlString(), "blogs") %><%
|
||||
}
|
||||
else { %>
|
||||
<p>No blogs found.</p><%
|
||||
} %>
|
@@ -1,6 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Blog>" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<h3><a href="<%=Url.Blog(Model.Slug) %>"><%=Html.Encode(Model.Name) %></a></h3>
|
||||
<div class="blog metadata"><a href="<%=Url.Blog(Model.Slug) %>"><%=Model.PostCount %> post<%=Model.PostCount == 1 ? "" : "s" %></a></div>
|
||||
<p><%=Model.Description %></p>
|
@@ -1,18 +1,7 @@
|
||||
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<BlogViewModel>" %>
|
||||
|
||||
<%@ Import Namespace="Orchard.Core.Common.Models" %>
|
||||
<%@ Import Namespace="Orchard.Models" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels" %>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
<%-- todo: (heskew) make master-less when we get into theming --%>
|
||||
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
|
||||
<%=Html.DisplayForItem(m=>m.Blog) %>
|
||||
<%-- <div class="manage"><a href="<%=Url.BlogEdit(Model.Blog.Slug) %>" class="ibutton edit">edit</a></div>
|
||||
<h2><%=Html.Encode(Model.Blog.Name) %></h2>
|
||||
<div><%=Html.Encode(Model.Blog.Description) %></div>
|
||||
<%=Html.UnorderedList(Model.Posts, (bp, i) => Html.DisplayForItem(bp).ToHtmlString(), "posts contentItems") %>
|
||||
--%>
|
||||
<%=Html.DisplayForItem(m => m.Blog) %>
|
||||
</asp:Content>
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<BlogsViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Models.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
|
||||
@@ -6,6 +7,11 @@
|
||||
<%-- todo: (heskew) make master-less when we get into theming --%>
|
||||
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
|
||||
<h2>Blogs</h2>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
<%=Html.DisplayForModel() %>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p><%
|
||||
if (Model.Blogs.Count() > 0) { %>
|
||||
<%=Html.UnorderedList(Model.Blogs, (b, i) => Html.DisplayForItem(b).ToHtmlString(), "blogs") %><%
|
||||
}
|
||||
else { %>
|
||||
<p>No blogs found.</p><%
|
||||
} %>
|
||||
</asp:Content>
|
@@ -1,17 +1,10 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ItemDisplayViewModel<Blog>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Models.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Models"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Core.Common.Models"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
|
||||
<div class="manage"><a href="<%=Url.BlogEdit(Model.Item.Slug) %>" class="ibutton edit">edit</a></div>
|
||||
<h2><%=Html.Encode(Model.Item.Name) %></h2>
|
||||
<div><%=Html.Encode(Model.Item.Description) %></div>
|
||||
<%=Html.DisplayZonesAny() %>
|
||||
|
||||
<%-- <div class="manage"><a href="<%=Url.BlogEdit(Model.Blog.Slug) %>" class="ibutton edit">edit</a></div>
|
||||
<h2><%=Html.Encode(Model.Blog.Name) %></h2>
|
||||
<div><%=Html.Encode(Model.Blog.Description) %></div>
|
||||
<%=Html.UnorderedList(Model.Posts, (bp, i) => Html.DisplayForItem(bp).ToHtmlString(), "posts contentItems") %>
|
||||
--%>
|
||||
<%--TODO: (erikpo) Need to figure out which zones should be displayed in this template--%>
|
||||
<%=Html.DisplayZonesAny() %>
|
@@ -0,0 +1,10 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ItemDisplayViewModel<Blog>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Models.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<h3><%=Html.Link(Html.Encode(Model.Item.Name), Url.Blog(Model.Item.Slug)) %></h3>
|
||||
<div class="blog metadata"><a href="<%=Url.Blog(Model.Item.Slug) %>"><%=Model.Item.PostCount %> post<%=Model.Item.PostCount == 1 ? "" : "s" %></a></div>
|
||||
<p><%=Model.Item.Description %></p>
|
||||
<%--TODO: (erikpo) Need to figure out which zones should be displayed in this template--%>
|
||||
<%--<%=Html.DisplayZonesAny() %>--%>
|
Reference in New Issue
Block a user