1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
@using Project_Unite.Controllers;
@model Project_Unite.Models.ForumTopic
@using Microsoft.AspNet.Identity
@{
ViewBag.Title = Model.Subject;
}
@if(ViewBag.Error != null)
{
<div class="panel panel-error">
<div class="panel-body">
<p><span class="glyphicon glyphicon-exclamation-sign"></span> @ViewBag.Error</p>
</div>
</div>
}
@if(Model.IsUnlisted == true)
{
<div class="panel panel-warning">
<div class="panel-body">
<p><span class="glyphicon glyphicon-eye-close"></span> <strong>This topic is unlisted.</strong> Only those with the topic link as well as moderators may see this topic. Please respect its privacy.</p>
</div>
</div>
}
<h2>@Model.Subject</h2>
<p>Started by <strong>@Html.UserLink(Model.AuthorId)</strong> at <strong>@Model.StartedAt</strong></p>
@{
Html.RenderPartial("~/Views/Shared/_ModeratorBar.cshtml", Model);
}
@foreach (Project_Unite.Models.ForumPost post in PaginationExtensions.GetItemsOnPage<Project_Unite.Models.ForumPost>(Model.Posts.OrderBy(x => x.PostedAt).ToArray(), ViewBag.Page, ViewBag.PageSize))
{
if (Request.IsAuthenticated)
{
if (ACL.IsUnread(User.Identity.GetUserId(), post.Id))
{
ACL.MarkRead(User.Identity.GetUserId(), post.Id);
}
}
<div class="row panel panel-default">
<div class="panel-body">
<div class="col-xs-4"> <!--Mini profile data-->
<img src="@ACL.GetUserInfo(post.AuthorId).AvatarUrl" width="128" height="128" /><br/>
<strong>@Html.UserLink(post.AuthorId)</strong><br/>
@{
var user = ACL.GetUserInfo(post.AuthorId);
<p><strong>@user.Codepoints</strong> Codepoints</p>
<p><strong><u>@user.HighestRole.Name</u></strong></p>
<p>
@if (ACL.Granted(User.Identity.Name, "CanAccessModCP"))
{
if (ACL.Granted(User.Identity.Name, "CanViewUserInfo"))
{
@Html.ActionLink("User info", "UserDetails", "Moderator", new { id = ACL.UserNameRaw(post.AuthorId) }, new { @class = "btn btn-default" })
}
}
</p>
}
</div>
<div class="col-xs-8" id="forum_post_body"><!--Post body, subject, author, time-->
<h4>@Model.Subject</h4>
<p>@Html.UserLink(post.AuthorId) at @post.PostedAt</p>
<p>@Html.Markdown(post.Body)</p>
@{
Html.RenderPartial("~/Views/Shared/_PostModerationBar.cshtml", post);
}
</div>
</div>
</div>
}
@{
Html.RenderPartial("~/Views/Shared/_ModeratorBar.cshtml", Model);
}
<ul class="pagination">
@for(int i = 1; i <= ViewBag.PageCount; i++)
{
if (i == ViewBag.Page - 1)
{
<li class="active">@Html.ActionLink(i.ToString(), "ViewTopic", "Forum", null, new { id = Model.Discriminator, page = i })</li>
}
else
{
<li>@Html.ActionLink(i.ToString(), "ViewTopic", "Forum", null, new { id = Model.Discriminator, page = i })</li>
}
}
</ul>
|