2010-10-15 14:40:35 -07:00
|
|
|
@using Orchard.Blogs.Extensions;
|
|
|
|
@using Orchard.Blogs.Models;
|
2010-09-17 01:00:24 -07:00
|
|
|
@{
|
2010-09-17 01:09:37 -07:00
|
|
|
Style.Require("BlogsArchives");
|
2010-09-17 16:09:43 -07:00
|
|
|
Script.Require("BlogsArchives");
|
2010-10-15 14:40:35 -07:00
|
|
|
IEnumerable<KeyValuePair<ArchiveData, int>> archives = Model.Archives;
|
2010-09-17 01:00:24 -07:00
|
|
|
}
|
|
|
|
<div class="archives">
|
|
|
|
<h3>@T("Archives")</h3>
|
2010-10-15 14:40:35 -07:00
|
|
|
@if (archives.Count() > 20) {
|
2010-09-17 01:00:24 -07:00
|
|
|
<ul class="years">
|
2010-10-12 17:33:08 -07:00
|
|
|
@{
|
2010-10-15 14:40:35 -07:00
|
|
|
int lastYear = archives.First().Key.Year;
|
|
|
|
int firstYear = archives.Last().Key.Year;
|
2010-10-12 17:33:08 -07:00
|
|
|
}
|
|
|
|
@for (int year = lastYear; year >= firstYear; year--) {
|
2010-10-15 14:40:35 -07:00
|
|
|
var yearMonths = archives.Where(m => m.Key.Year == year);
|
2010-10-12 17:33:08 -07:00
|
|
|
|
|
|
|
if (year == lastYear) {
|
2010-09-17 01:00:24 -07:00
|
|
|
<li>
|
|
|
|
<h4>@year</h4>
|
2010-10-12 17:33:08 -07:00
|
|
|
</li>
|
|
|
|
}
|
|
|
|
|
|
|
|
if (year != lastYear) {
|
2010-09-17 01:00:24 -07:00
|
|
|
<li class="previous">
|
|
|
|
<h4>@year <span>(@yearMonths.Sum(ym => ym.Value))</span></h4>
|
2010-10-15 14:40:35 -07:00
|
|
|
@Html.UnorderedList(yearMonths, (t, i) => Html.Link(string.Format("{0:MMMM} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth((string)Model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList")
|
2010-09-17 01:00:24 -07:00
|
|
|
</li>
|
|
|
|
}
|
|
|
|
}
|
2010-10-12 17:33:08 -07:00
|
|
|
</ul>
|
|
|
|
}
|
2010-10-15 14:40:35 -07:00
|
|
|
else if (archives.Count() > 0) {
|
|
|
|
@Html.UnorderedList(archives, (t, i) => Html.Link(string.Format("{0:MMMM yyyy} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth((string)Model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList")
|
2010-10-12 17:33:08 -07:00
|
|
|
}
|
|
|
|
else {
|
2010-09-17 01:00:24 -07:00
|
|
|
<div class="message info">@T("None found")</div>
|
|
|
|
}
|
|
|
|
</div>
|