mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 17:22:15 +00:00
individual post subjects
This commit is contained in:
parent
7bc8f60923
commit
588d21569c
5 changed files with 35 additions and 1 deletions
|
@ -47,6 +47,7 @@ public ActionResult PostReply(string id, string fid)
|
||||||
|
|
||||||
var model = new CreateTopicViewModel();
|
var model = new CreateTopicViewModel();
|
||||||
model.Category = id;
|
model.Category = id;
|
||||||
|
model.Subject = new ApplicationDbContext().ForumTopics.FirstOrDefault(x => x.Discriminator == id).Subject;
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@ public ForumTopic[] Topics
|
||||||
public class ForumPost
|
public class ForumPost
|
||||||
{
|
{
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public string Subject { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Parent { get; set; }
|
public string Parent { get; set; }
|
||||||
|
|
|
@ -12,7 +12,11 @@
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<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>
|
<p>This is the content of your topic. You can use Markdown formatting to style your post.</p>
|
||||||
</td>
|
</td>
|
||||||
<td>@Html.TextAreaFor(Model => Model.Body, new { @class = "form-control", style = "width:100%", rows = "10" })</td>
|
<td>@Html.TextAreaFor(Model => Model.Body, new { @class = "form-control", style = "width:100%", rows = "10" })</td>
|
||||||
|
|
|
@ -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/>
|
<hr/>
|
||||||
|
|
||||||
@if (Model.Topics.Length > 0)
|
@if (Model.Topics.Length > 0)
|
||||||
|
@ -58,6 +70,11 @@
|
||||||
<div class="col-xs-2">
|
<div class="col-xs-2">
|
||||||
<strong>@topic.Posts.Length</strong>
|
<strong>@topic.Posts.Length</strong>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,16 @@
|
||||||
@using Microsoft.AspNet.Identity
|
@using Microsoft.AspNet.Identity
|
||||||
@{
|
@{
|
||||||
ViewBag.Title = Model.Subject;
|
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">
|
<ul class="nav nav-tabs">
|
||||||
|
|
Loading…
Reference in a new issue