From 9301e9eb0a0d8e01c1521e1e884700af3a97a73c Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Mon, 19 Jul 2010 11:13:23 -0700 Subject: [PATCH] Fixed the display of blog posts on a blog in all of the themes - added a default blog list template and remove all of the theme-specific part templates (which were all the same) --HG-- branch : dev --- .../Orchard.Blogs/Drivers/BlogDriver.cs | 2 +- .../Orchard.Blogs/Orchard.Blogs.csproj | 1 + .../Blogs.BlogPost.List.DetailAdmin.ascx | 28 +++++++++++++++++ .../Parts/Blogs.BlogPost.List.ascx | 31 ++----------------- src/Orchard.Web/Orchard.Web.csproj | 4 --- .../Parts/Blogs.BlogPost.List.ascx | 5 --- .../Parts/Blogs.BlogPost.List.ascx | 5 --- .../Parts/Blogs.BlogPost.List.ascx | 6 ---- .../Parts/Blogs.BlogPost.List.ascx | 6 ---- 9 files changed, 33 insertions(+), 55 deletions(-) create mode 100644 src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.DetailAdmin.ascx delete mode 100644 src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx delete mode 100644 src/Orchard.Web/Themes/ClassicDark/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx delete mode 100644 src/Orchard.Web/Themes/Contoso/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx delete mode 100644 src/Orchard.Web/Themes/Corporate/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogDriver.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogDriver.cs index 3a5451ec0..eeb6d0f71 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogDriver.cs @@ -89,7 +89,7 @@ namespace Orchard.Blogs.Drivers { }).ToList() }, "Parts/Blogs.BlogPost.List", - "").Location("primary")); + "").LongestMatch(displayType, "DetailAdmin").Location("primary")); } protected override DriverResult Editor(Blog blog) { diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj index 53571cbfc..30df21d5f 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj @@ -134,6 +134,7 @@ + diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.DetailAdmin.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.DetailAdmin.ascx new file mode 100644 index 000000000..e60031c58 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.DetailAdmin.ascx @@ -0,0 +1,28 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %> +<%@ Import Namespace="Orchard.Utility.Extensions" %> +<% +if (Model.Entries.Count() < 1) { %> +
<%:T("There are no posts for this blog.") %>
<% +} +else { + using (Html.BeginFormAntiForgeryPost(Url.Action("List", "Admin", new { area = "Contents", id = "" }))) { %> +
+ + + <%:Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString()) %> + +
+
+ <%:Html.UnorderedList( + Model.Entries, + (entry, i) => Html.DisplayForItem(entry.ViewModel), + "") %> +
<% + } +} %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx index e60031c58..0f938e631 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx @@ -1,28 +1,3 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %> -<%@ Import Namespace="Orchard.Utility.Extensions" %> -<% -if (Model.Entries.Count() < 1) { %> -
<%:T("There are no posts for this blog.") %>
<% -} -else { - using (Html.BeginFormAntiForgeryPost(Url.Action("List", "Admin", new { area = "Contents", id = "" }))) { %> -
- - - <%:Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString()) %> - -
-
- <%:Html.UnorderedList( - Model.Entries, - (entry, i) => Html.DisplayForItem(entry.ViewModel), - "") %> -
<% - } -} %> \ No newline at end of file +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%: Html.UnorderedList(Model.Entries, (bp, i) => Html.DisplayForItem(bp.ViewModel), "blogPosts contentItems") %> +<% if (Model.Entries.Count() < 1) { %>

<%: T("There are no posts for this blog.") %>

<% } %> diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj index 0a9866d9b..7a429e52e 100644 --- a/src/Orchard.Web/Orchard.Web.csproj +++ b/src/Orchard.Web/Orchard.Web.csproj @@ -139,7 +139,6 @@ - @@ -157,7 +156,6 @@ - @@ -192,7 +190,6 @@ - @@ -237,7 +234,6 @@ - diff --git a/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx b/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx deleted file mode 100644 index 3924f0158..000000000 --- a/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx +++ /dev/null @@ -1,5 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>>" %> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Blogs.Models"%> -<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %> -<% if (Model.Count() < 1) { %>

<%: T("There are no posts for this blog.") %>

<% } %> diff --git a/src/Orchard.Web/Themes/ClassicDark/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx b/src/Orchard.Web/Themes/ClassicDark/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx deleted file mode 100644 index 3924f0158..000000000 --- a/src/Orchard.Web/Themes/ClassicDark/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx +++ /dev/null @@ -1,5 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>>" %> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Blogs.Models"%> -<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %> -<% if (Model.Count() < 1) { %>

<%: T("There are no posts for this blog.") %>

<% } %> diff --git a/src/Orchard.Web/Themes/Contoso/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx b/src/Orchard.Web/Themes/Contoso/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx deleted file mode 100644 index 49c4749b7..000000000 --- a/src/Orchard.Web/Themes/Contoso/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx +++ /dev/null @@ -1,6 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>>" %> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Blogs.Models"%> - -<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %> -<% if (Model.Count() < 1) { %>

<%: T("There are no posts for this blog.") %>

<% } %> diff --git a/src/Orchard.Web/Themes/Corporate/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx b/src/Orchard.Web/Themes/Corporate/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx deleted file mode 100644 index 49c4749b7..000000000 --- a/src/Orchard.Web/Themes/Corporate/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx +++ /dev/null @@ -1,6 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>>" %> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Blogs.Models"%> - -<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %> -<% if (Model.Count() < 1) { %>

<%: T("There are no posts for this blog.") %>

<% } %>