Files
OurUmbraco/OurUmbraco.Site/Views/MacroPartials/Forum/LatestActivity.cshtml
T
2015-07-26 19:57:02 +02:00

54 lines
1.6 KiB
Plaintext

@using OurUmbraco.Forum.Extensions
@using OurUmbraco.Forum.Models
@using OurUmbraco.Forum.Services
@using OurUmbraco.Our
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var ts = new TopicService(ApplicationContext.DatabaseContext);
}
<div class="col-md-12 flex">
@Column(ts.GetLatestTopics(6, 1))
</div>
@helper Column(IEnumerable<ReadOnlyTopic> topics)
{
foreach (var topic in topics.ToArray())
{
var cat = Umbraco.TypedContent(topic.ParentId);
var mem = Members.GetById(topic.LatestReplyAuthor) ?? Members.GetById(topic.MemberId);
<a href="@topic.GetUrl()" class="forum-thread">
<div class="avatar">
@if(mem != null)
{
@Html.Raw(Utils.GetMemberAvatar(mem, 100))
}
</div>
<div class="meta">
<div class="forum-thread-text">
<h3>@topic.Title</h3>
<p>
@if (topic.Replies != 0 && !string.IsNullOrEmpty(topic.LastReplyAuthorName))
{
<text>last edited by @topic.LastReplyAuthorName</text>
}
else
{
<text>created by @topic.AuthorName</text>
}
@topic.Updated.ConvertToRelativeTime()
</p>
</div>
<div class="category">
<span class="cat">@cat.Name</span>
</div>
</div>
</a>
}
}