mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-02-02 13:07:34 +00:00
User posting front-end
This commit is contained in:
parent
2dcb12403b
commit
966ad0c588
3 changed files with 43 additions and 0 deletions
|
@ -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\" />
|
||||
|
|
14
Project-Unite/Views/Profile/_NewPost.cshtml
Normal file
14
Project-Unite/Views/Profile/_NewPost.cshtml
Normal 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>
|
||||
|
||||
|
||||
|
|
@ -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>
|
Loading…
Add table
Reference in a new issue