Project-Unite/Project-Unite/Views/Profiles/ViewProfile.cshtml
2017-03-24 16:03:23 -04:00

95 lines
No EOL
3.2 KiB
Text

@model Project_Unite.Models.ApplicationUser
@{
ViewBag.Title = Model.DisplayName;
ViewBag.Banner = Model.BannerUrl;
}
<div class="row">
<h3>
<img src="@Model.AvatarUrl" width="64" height="64" /> @if (string.IsNullOrWhiteSpace(Model.FullName))
{ <strong> @Model.DisplayName </strong>}
else
{
<strong>@Model.FullName</strong> <em>(@Model.DisplayName)</em>}
</h3>
</div>
<ul class="nav nav-pills">
@if (Model.UserName != User.Identity.Name)
{
if (ACL.IsFollowed(User.Identity.Name, Model.Id))
{
<li><a href="@Url.Action("UnfollowUser", "Profiles", new { id = Model.Id })"><span class="glyphicon glyphicon-eye-close"></span> Unfollow</a></li>
}
else
{
<li><a href="@Url.Action("FollowUser", "Profiles", new { id = Model.Id })"><span class="glyphicon glyphicon-eye-open"></span> Follow</a></li>
}
}
</ul>
<div class="row">
<div class="col-xs-3">
<h4>User stats</h4>
<ul>
<li><strong>@Model.Codepoints</strong> Codepoints</li>
<li><strong>Joined at: </strong>@Model.JoinedAt</li>
<li><strong>Posts: </strong>@Model.PostCount</li>
<li><strong>Topics: </strong>@Model.TopicCount</li>
</ul>
</div>
<div class="col-xs-5">
@if(Model.UserName == User.Identity.Name)
{
Html.RenderPartial("~/Views/Profiles/_NewPost.cshtml", new Project_Unite.Models.UserPost());
}
@foreach(var post in Model.Posts.OrderByDescending(x => x.PostedAt))
{
<div class="panel">
<div class="panel-body">
<p><strong>Posted on @post.PostedAt</strong>:</p>
<p>@Html.Markdown(post.PostContents)</p>
<ul class="nav nav-pills">
@{
string likeLink = "#";
string dislikeLink = "";
if(Model.UserName != User.Identity.Name)
{
likeLink = "/Profiles/LikePost/" + post.Id;
dislikeLink = likeLink.Replace("Like", "Dislike");
}
}
<li><a href="@likeLink"><span class="glyphicon glyphicon-thumbs-up"></span> @post.Likes.Length</a></li>
<li><a href="@dislikeLink"><span class="glyphicon glyphicon-thumbs-down"></span> @post.Dislikes.Length</a></li>
</ul>
</div>
</div>
}
</div>
<div class="col-xs-3">
<div class="panel">
<div class="panel-body">
<h4>Followers</h4>
<ul>
@foreach(var f in Model.Followers)
{
<li>@Html.UserLink(f.Follower)</li>
}
</ul>
</div>
</div>
<div class="panel">
<div class="panel-body">
<h4>Following</h4>
<ul>
@foreach (var f in Model.Followed)
{
<li>@Html.UserLink(f.Followed)</li>
}
</ul>
</div>
</div>
</div>
</div>