User posting front-end

This commit is contained in:
Michael 2017-03-23 19:16:46 -04:00
parent 2dcb12403b
commit 966ad0c588
3 changed files with 43 additions and 0 deletions

View file

@ -508,6 +508,7 @@
<Content Include="Views\Legal\TOS.cshtml" />
<Content Include="Views\Profiles\ViewProfile.cshtml" />
<Content Include="Views\Profile\ViewProfile.cshtml" />
<Content Include="Views\Profile\_NewPost.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />

View file

@ -0,0 +1,14 @@
@model Project_Unite.Models.UserPost
<div class="panel">
@using (Html.BeginForm("PostContent", "Profiles"))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary();
@Html.TextAreaFor(Model=>Model.PostContents, new {@class="form-control", rows="5"})
<input type="submit" class="btn btn-default" value="Post" />
}
</div>

View file

@ -24,4 +24,32 @@
<li><strong>Topics: </strong>@Model.TopicCount</li>
</ul>
</div>
<div class="col-xs-4">
@if(Model.UserName == User.Identity.Name)
{
Html.RenderPartial("~/Profiles/_NewPost.cshtml", new Project_Unite.Models.UserPost());
}
@foreach(var post in Model.Posts.OrderByDescending(x => x.PostedAt))
{
<div class="panel">
<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-thumbs-up"></span> @post.Likes.Length</a></li>
<li><a href="@dislikeLink"><span class="glyphicon-thumbs-down"></span> @post.Dislikes.Length</a></li>
</ul>
</div>
}
</div>
</div>