mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
40 lines
1.5 KiB
Plaintext
40 lines
1.5 KiB
Plaintext
@using Orchard.Blogs.Extensions;
|
|
@using Orchard.Blogs.Models;
|
|
@{
|
|
Style.Require("BlogsArchives");
|
|
Script.Require("BlogsArchives");
|
|
IEnumerable<KeyValuePair<ArchiveData, int>> archives = Model.Archives;
|
|
}
|
|
<div class="archives">
|
|
<h3>@T("Archives")</h3>
|
|
@if (archives.Count() > 20) {
|
|
<ul class="years">
|
|
@{
|
|
int lastYear = archives.First().Key.Year;
|
|
int firstYear = archives.Last().Key.Year;
|
|
}
|
|
@for (int year = lastYear; year >= firstYear; year--) {
|
|
var yearMonths = archives.Where(m => m.Key.Year == year);
|
|
|
|
if (year == lastYear) {
|
|
<li>
|
|
<h4>@year</h4>
|
|
</li>
|
|
}
|
|
|
|
if (year != lastYear) {
|
|
<li class="previous">
|
|
<h4>@year <span>(@yearMonths.Sum(ym => ym.Value))</span></h4>
|
|
@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")
|
|
</li>
|
|
}
|
|
}
|
|
</ul>
|
|
}
|
|
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")
|
|
}
|
|
else {
|
|
<div class="message info">@T("None found")</div>
|
|
}
|
|
</div> |