diff options
| author | Michael <[email protected]> | 2017-05-17 16:23:55 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-05-17 16:23:55 -0400 |
| commit | 588d21569c6a6adfcb9a75c29c57c43dc7954f06 (patch) | |
| tree | 75634d29d404e55372e9043a2dee3c2cf528a197 /Project-Unite | |
| parent | 7bc8f60923470059ea0322c52cc05b0c6adae37e (diff) | |
| download | project-unite-588d21569c6a6adfcb9a75c29c57c43dc7954f06.tar.gz project-unite-588d21569c6a6adfcb9a75c29c57c43dc7954f06.tar.bz2 project-unite-588d21569c6a6adfcb9a75c29c57c43dc7954f06.zip | |
individual post subjects
Diffstat (limited to 'Project-Unite')
| -rw-r--r-- | Project-Unite/Controllers/ForumController.cs | 1 | ||||
| -rw-r--r-- | Project-Unite/Models/ForumCategory.cs | 2 | ||||
| -rw-r--r-- | Project-Unite/Views/Forum/PostReply.cshtml | 6 | ||||
| -rw-r--r-- | Project-Unite/Views/Forum/ViewForum.cshtml | 17 | ||||
| -rw-r--r-- | Project-Unite/Views/Forum/ViewTopic.cshtml | 10 |
5 files changed, 35 insertions, 1 deletions
diff --git a/Project-Unite/Controllers/ForumController.cs b/Project-Unite/Controllers/ForumController.cs index 3eb3c83..888c41e 100644 --- a/Project-Unite/Controllers/ForumController.cs +++ b/Project-Unite/Controllers/ForumController.cs @@ -47,6 +47,7 @@ namespace Project_Unite.Controllers var model = new CreateTopicViewModel(); model.Category = id; + model.Subject = new ApplicationDbContext().ForumTopics.FirstOrDefault(x => x.Discriminator == id).Subject; return View(model); } diff --git a/Project-Unite/Models/ForumCategory.cs b/Project-Unite/Models/ForumCategory.cs index 52e184e..96c826e 100644 --- a/Project-Unite/Models/ForumCategory.cs +++ b/Project-Unite/Models/ForumCategory.cs @@ -50,6 +50,8 @@ namespace Project_Unite.Models public class ForumPost { public string Id { get; set; } + + public string Subject { get; set; } [Required] public string Parent { get; set; } diff --git a/Project-Unite/Views/Forum/PostReply.cshtml b/Project-Unite/Views/Forum/PostReply.cshtml index 2305204..6080a79 100644 --- a/Project-Unite/Views/Forum/PostReply.cshtml +++ b/Project-Unite/Views/Forum/PostReply.cshtml @@ -12,7 +12,11 @@ <table class="table"> <tr> - <td>@Html.DisplayNameFor(Model => Model.Body) + <td><strong>Subject:</strong></td> + <td>@Html.TextBoxFor(Model=>Model.Subject, new{@class="form-control"})</td> + </tr> + <tr> + <td style="width:25%;">@Html.DisplayNameFor(Model => Model.Body) <p>This is the content of your topic. You can use Markdown formatting to style your post.</p> </td> <td>@Html.TextAreaFor(Model => Model.Body, new { @class = "form-control", style = "width:100%", rows = "10" })</td> diff --git a/Project-Unite/Views/Forum/ViewForum.cshtml b/Project-Unite/Views/Forum/ViewForum.cshtml index e4b528f..92fb802 100644 --- a/Project-Unite/Views/Forum/ViewForum.cshtml +++ b/Project-Unite/Views/Forum/ViewForum.cshtml @@ -37,6 +37,18 @@ } } +@{ + var db = new Project_Unite.Models.ApplicationDbContext(); + var globals = Model.Topics.Where(x => x.ShouldShow == true&&x.IsGlobal==true).OrderByDescending(x => x.StartedAt); + +} + +@if (globals.Count() > 0) +{ + <hr /> + +} + <hr/> @if (Model.Topics.Length > 0) @@ -58,6 +70,11 @@ <div class="col-xs-2"> <strong>@topic.Posts.Length</strong> </div> + <div class="col-xs-4"> + @topic.Posts.OrderByDescending(x => x.PostedAt).First().Subject <br /> + by @Html.UserLink(topic.Posts.OrderByDescending(x => x.PostedAt).First().AuthorId) <br/> + at @topic.Posts.OrderByDescending(x => x.PostedAt).First().PostedAt + </div> </div> } } diff --git a/Project-Unite/Views/Forum/ViewTopic.cshtml b/Project-Unite/Views/Forum/ViewTopic.cshtml index ed6b7c0..61ef682 100644 --- a/Project-Unite/Views/Forum/ViewTopic.cshtml +++ b/Project-Unite/Views/Forum/ViewTopic.cshtml @@ -3,6 +3,16 @@ @using Microsoft.AspNet.Identity @{ ViewBag.Title = Model.Subject; + var db = new Project_Unite.Models.ApplicationDbContext(); + var posts = db.ForumPosts.Where(x => x.Parent == Model.Id); + foreach(var post in posts.ToArray()) + { + if (string.IsNullOrWhiteSpace(post.Subject)) + { + post.Subject = Model.Subject; + } + } + db.SaveChanges(); } <ul class="nav nav-tabs"> |
