Archive link fix, restored missing months for current year of archives

--HG--
branch : 1.x
This commit is contained in:
Bertrand@Nutella
2012-02-23 17:58:25 -08:00
parent 768b4ecc2c
commit bfef980775
2 changed files with 8 additions and 4 deletions

View File

@@ -31,15 +31,18 @@ namespace Orchard.Blogs.Extensions {
} }
public static string BlogArchiveYear(this UrlHelper urlHelper, BlogPart blogPart, int year) { public static string BlogArchiveYear(this UrlHelper urlHelper, BlogPart blogPart, int year) {
return urlHelper.Action("ListByArchive", "BlogPost", new { path = VirtualPathUtility.Combine((blogPart.As<IAliasAspect>().Path ?? string.Empty) + "/", "archive/") + year.ToString(), area = "Orchard.Blogs" }); var blogPath = blogPart.As<IAliasAspect>().Path;
return urlHelper.Action("ListByArchive", "BlogPost", new { path = (string.IsNullOrWhiteSpace(blogPath) ? "archive/" : blogPath + "/archive/") + year.ToString(), area = "Orchard.Blogs" });
} }
public static string BlogArchiveMonth(this UrlHelper urlHelper, BlogPart blogPart, int year, int month) { public static string BlogArchiveMonth(this UrlHelper urlHelper, BlogPart blogPart, int year, int month) {
return urlHelper.Action("ListByArchive", "BlogPost", new { path = VirtualPathUtility.Combine((blogPart.As<IAliasAspect>().Path ?? string.Empty) + "/", "archive/") + string.Format("{0}/{1}", year, month), area = "Orchard.Blogs" }); var blogPath = blogPart.As<IAliasAspect>().Path;
return urlHelper.Action("ListByArchive", "BlogPost", new { path = (string.IsNullOrWhiteSpace(blogPath) ? "archive/" : blogPath + "/archive/") + string.Format("{0}/{1}", year, month), area = "Orchard.Blogs" });
} }
public static string BlogArchiveDay(this UrlHelper urlHelper, BlogPart blogPart, int year, int month, int day) { public static string BlogArchiveDay(this UrlHelper urlHelper, BlogPart blogPart, int year, int month, int day) {
return urlHelper.Action("ListByArchive", "BlogPost", new { path = VirtualPathUtility.Combine((blogPart.As<IAliasAspect>().Path ?? string.Empty) + "/", "archive/") + string.Format("{0}/{1}/{2}", year, month, day), area = "Orchard.Blogs" }); var blogPath = blogPart.As<IAliasAspect>().Path;
return urlHelper.Action("ListByArchive", "BlogPost", new { path = (string.IsNullOrWhiteSpace(blogPath) ? "archive/" : blogPath + "/archive/") + string.Format("{0}/{1}/{2}", year, month, day), area = "Orchard.Blogs" });
} }
public static string BlogForAdmin(this UrlHelper urlHelper, BlogPart blogPart) { public static string BlogForAdmin(this UrlHelper urlHelper, BlogPart blogPart) {

View File

@@ -18,7 +18,8 @@
if (year == lastYear) { if (year == lastYear) {
<li> <li>
<h4>@year</h4> <h4>@year</h4>
</li> @Html.UnorderedList(yearMonths, (t, i) => Html.Link(string.Format("{0:MMMM} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth((BlogPart)Model.Blog, t.Key.Year, t.Key.Month)), "archiveMonthList")
</li>
} }
if (year != lastYear) { if (year != lastYear) {