diff options
| author | Michael <[email protected]> | 2017-03-20 16:45:17 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-03-20 16:45:17 -0400 |
| commit | cdc61eb4ea5309769ad4db84d92594e4dc3dff67 (patch) | |
| tree | a8297a7aecc4376f07a497a5e02ab5ff165bfbd3 /Project-Unite/Views/Forum | |
| parent | d9f475e1f33bbf39ca0d79d7a6b0c2fd501b4f2d (diff) | |
| download | project-unite-cdc61eb4ea5309769ad4db84d92594e4dc3dff67.tar.gz project-unite-cdc61eb4ea5309769ad4db84d92594e4dc3dff67.tar.bz2 project-unite-cdc61eb4ea5309769ad4db84d92594e4dc3dff67.zip | |
Initial commit (azure deploy test)
Diffstat (limited to 'Project-Unite/Views/Forum')
| -rw-r--r-- | Project-Unite/Views/Forum/CreateTopic.cshtml | 86 | ||||
| -rw-r--r-- | Project-Unite/Views/Forum/EditPost.cshtml | 37 | ||||
| -rw-r--r-- | Project-Unite/Views/Forum/Index.cshtml | 39 | ||||
| -rw-r--r-- | Project-Unite/Views/Forum/PostReply.cshtml | 27 | ||||
| -rw-r--r-- | Project-Unite/Views/Forum/ViewForum.cshtml | 166 | ||||
| -rw-r--r-- | Project-Unite/Views/Forum/ViewTopic.cshtml | 69 |
6 files changed, 424 insertions, 0 deletions
diff --git a/Project-Unite/Views/Forum/CreateTopic.cshtml b/Project-Unite/Views/Forum/CreateTopic.cshtml new file mode 100644 index 0000000..cb080dd --- /dev/null +++ b/Project-Unite/Views/Forum/CreateTopic.cshtml @@ -0,0 +1,86 @@ +@model Project_Unite.Models.CreateTopicViewModel +@{ + ViewBag.Title = "Create topic"; +} + +<h2>Create topic</h2> + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model => Model.Category) + + <table class="table"> + <tr> + <td style="width:25%">@Html.DisplayNameFor(Model => Model.Subject)</td> + <td>@Html.TextBoxFor(Model => Model.Subject, new { @class = "form-control", style = "width:100%" })</td> + </tr> + <tr> + <td>@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> + </tr> + <tr> + <td></td> + <td><input type="submit" value="Post" class="btn btn-primary" /></td> + </tr> + </table> + + <h3>Topic options</h3> + + + bool showGeneral = false; + if (ACL.Granted(User.Identity.Name, "CanStickyOwnTopics") || ACL.Granted(User.Identity.Name, "CanGlobalOwnTopics") || ACL.Granted(User.Identity.Name, "CanAnnounceOwnTopics")) + { + showGeneral = true; + } + string generalStyle = "tab-pane fade in"; + string pollStyle = "tab-pane fade in"; + if (showGeneral == true) { + generalStyle += " active"; + + } + else + { + pollStyle += " active"; + } + + + <ul id="tabs" data-tabs="tabs" class="nav nav-tabs" role="tablist"> + @if (showGeneral) + { + <li class="active"><a data-toggle="tab" href="#t_general">Topic status</a></li> + <li><a data-toggle="tab" href="#t_polls">Polls</a></li> + } + else + { + <li class="active"><a data-toggle="tab" href="#t_polls">Polls</a></li> + } + </ul> + + <div class="tab-content"> + <div class="@generalStyle" id="t_general"> + <h4>Topic status</h4> + + <p>Below you can set the status of your topic.</p> + + @if (ACL.Granted(User.Identity.Name, "CanStickyOwnTopics")) + { + <p><strong>Sticky: </strong>@Html.CheckBoxFor(Model => Model.IsSticky, new { @class = "form-control" })</p> + } + @if (ACL.Granted(User.Identity.Name, "CanAnnounceOwnTopics")) + { + <p><strong>Announcement: </strong>@Html.CheckBoxFor(Model => Model.IsAnnounce, new { @class = "form-control" })</p> + } + @if (ACL.Granted(User.Identity.Name, "CanGlobalOwnTopics")) + { + <p><strong>Global announcement: </strong>@Html.CheckBoxFor(Model => Model.IsGlobal, new { @class = "form-control" })</p> + } + </div> + <div class="@pollStyle" id="t_polls"> + <h4>Polls</h4> + <p>Not yet implemented.</p> + </div> + </div> +}
\ No newline at end of file diff --git a/Project-Unite/Views/Forum/EditPost.cshtml b/Project-Unite/Views/Forum/EditPost.cshtml new file mode 100644 index 0000000..ea02f6f --- /dev/null +++ b/Project-Unite/Views/Forum/EditPost.cshtml @@ -0,0 +1,37 @@ +@model Project_Unite.Models.EditPostViewModel +@{ + ViewBag.Title = "Edit post"; +} + +<h2>Edit post</h2> + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model=>Model.Id) + <table class="table"> + <tr> + <td style="width:25%"> + <p><strong>Body:</strong></p> + <p>Make your edits to the post in this field. CommonMark-compliant Markdown is supported.</p> + </td> + <td> + @Html.TextAreaFor(Model=>Model.Contents, new { rows = "10", @class="form-control" }) + </td> + </tr> + <tr> + <td style="width:25%"> + <p><strong>Edit reason:</strong></p> + <p>Why did you edit the post? This reason is displayed in the Moderator Control Panel as well as at the bottom of the post.</p> + </td> + <td> + @Html.TextBoxFor(Model => Model.EditReason, new { @class = "form-control" }) + </td> + </tr> + <tr> + <td></td> + <td><input type="submit" value="Save" class="btn btn-primary" /></td> + </tr> + </table> +} + diff --git a/Project-Unite/Views/Forum/Index.cshtml b/Project-Unite/Views/Forum/Index.cshtml new file mode 100644 index 0000000..8e26c24 --- /dev/null +++ b/Project-Unite/Views/Forum/Index.cshtml @@ -0,0 +1,39 @@ +@model IEnumerable<Project_Unite.Models.ForumCategory> + +@{ + ViewBag.Title = "Forums"; +} + +<h2>Welcome to the forums.</h2> + +@foreach (var cat in Model) +{ + <table class="table"> + <tr> + <th>@cat.Name</th> + <th>Topics</th> + <th>Posts</th> + <th>Most Recent Post</th> + </tr> + @foreach (var subcat in cat.Children) + { + <tr> + <td>@Html.ActionLink(subcat.Name, "ViewForum", "Forum", new { id = subcat.Id }, null) <br/> + <p>@subcat.Description</p> + @if(subcat.Children.Length > 0) + { + <p><strong>Subforums: </strong> + @foreach(var subfrm in subcat.Children) + { + <em> @Html.ActionLink(subfrm.Name, "ViewForum", "Forum", new { id = subfrm.Id }, null) </em> + } + </p> + } + </td> + <td>@subcat.Topics.Length</td> + <td></td> + <td></td> + </tr> + } + </table> +}
\ No newline at end of file diff --git a/Project-Unite/Views/Forum/PostReply.cshtml b/Project-Unite/Views/Forum/PostReply.cshtml new file mode 100644 index 0000000..2305204 --- /dev/null +++ b/Project-Unite/Views/Forum/PostReply.cshtml @@ -0,0 +1,27 @@ +@model Project_Unite.Models.CreateTopicViewModel +@{ + ViewBag.Title = "Post reply"; +} + +<h2>Post reply</h2> + +@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + @Html.HiddenFor(Model => Model.Category) + + <table class="table"> + <tr> + <td>@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> + </tr> + <tr> + <td></td> + <td><input type="submit" value="Post" class="btn btn-primary" /></td> + </tr> + </table> + + +}
\ No newline at end of file diff --git a/Project-Unite/Views/Forum/ViewForum.cshtml b/Project-Unite/Views/Forum/ViewForum.cshtml new file mode 100644 index 0000000..01f1d01 --- /dev/null +++ b/Project-Unite/Views/Forum/ViewForum.cshtml @@ -0,0 +1,166 @@ +@model Project_Unite.Models.ForumCategory +@{ + ViewBag.Title = "View forum"; +} + +<h2>@Model.Name</h2> + +@if (Model.Parent == "root") +{ + @Html.ActionLink("Back", "Index", "Forum", null, new { @class = "btn btn-default" }) + +} +else +{ + @Html.ActionLink("Back", "ViewForum", "Forum", new { id=Model.Parent}, new { @class = "btn btn-default" }) +} + +@if(ACL.CanPost(User.Identity.Name, Model.Id)) +{ + @Html.ActionLink("New topic", "CreateTopic", "Forum", new { id=Model.Id}, new { @class = "btn btn-default" }) +} + +<p>@Model.Description</p> + +@if (Model.Children.Length > 0) +{ + <table class="table"> + <tr> + <th>Subforums</th> + <th>Topics</th> + <th>Posts</th> + <th>Most Recent Post</th> + </tr> + @foreach (var cat in Model.Children) + { + <tr> + <td>@Html.ActionLink(cat.Name, "ViewForum", "Forum", new { id = cat.Id }, null) + <p>@cat.Description</p> + </td> + <td> + @cat.Topics.Length + </td> + <td></td> + <td></td> + </tr> + } + </table> +} + +<hr/> + +@if (Model.Topics.Length > 0) +{ + <table class="table"> + <tr> + <th>Topics</th> + <th>Posts</th> + <th>Most recent post</th> + </tr> + @{ + var stickies = Model.Topics.Where(x => x.IsSticky == true); + var stickiesSorted = stickies.OrderByDescending(x => x.StartedAt); + var topicsSorted = Model.Topics.Where(x => x.IsSticky != true).OrderByDescending(x => x.StartedAt); + } + + @foreach (var topic in stickiesSorted) + { + bool showTopic = true; + if (topic.IsUnlisted == true) + { + if(!ACL.Granted(User.Identity.Name, "CanSeeUnlistedTopics")) + { + showTopic = false; + } + } + + if (showTopic == true) + { + <tr> + <td><span class="glyphicon glyphicon-star"></span> + @if(topic.IsUnlisted == true) + { + <span class="glyphicon glyphicon-eye-close"></span> + } + @if (topic.IsLocked == true) + { + <span class="glyphicon glyphicon-lock"></span> + } + + @Html.ActionLink(topic.Subject, "ViewTopic", "Forum", new { id = topic.Discriminator }, null) + <p>Started by @Html.UserLink(topic.AuthorId) on @topic.StartedAt</p> + </td> + <td> + @topic.Posts.Length + </td> + <td style="text-align:center"> + @if (topic.Posts.Length > 0) + { + var mostRecent = topic.Posts.OrderByDescending(x => x.PostedAt).First(); + <strong>Re: @topic.Subject</strong> + <em>by @Html.UserLink(mostRecent.AuthorId)</em> + <p><em>at @mostRecent.PostedAt</em></p> + } + else + { + <em>No posts.</em> + } + </td> + </tr> + } + } + @foreach (var topic in topicsSorted) + { + + bool showTopic = true; + if (topic.IsUnlisted == true) + { + if (!ACL.Granted(User.Identity.Name, "CanSeeUnlistedTopics")) + { + showTopic = false; + } + } + + if (showTopic == true) + { + <tr> + <td> + @if(topic.IsUnlisted == true) + { + <span class="glyphicon glyphicon-eye-close"></span> + } + + @if (topic.IsLocked == true) + { + <span class="glyphicon glyphicon-lock"></span> + } + @Html.ActionLink(topic.Subject, "ViewTopic", "Forum", new { id = topic.Discriminator }, null) + <p>Started by @Html.UserLink(topic.AuthorId) on @topic.StartedAt</p> + </td> + <td> + @topic.Posts.Length + </td> + <td style="text-align:center"> + @if (topic.Posts.Length > 0) + { + var mostRecent = topic.Posts.OrderByDescending(x => x.PostedAt).First(); + <strong>Re: @topic.Subject</strong> + <em>by @Html.UserLink(mostRecent.AuthorId)</em> + <p><em>at @mostRecent.PostedAt</em></p> + } + else + { + <em>No posts.</em> + } + </td> + </tr> + } + } + + + </table> +} +else +{ + <p>No topics exist in this category. Be the first to start one!</p> +}
\ No newline at end of file diff --git a/Project-Unite/Views/Forum/ViewTopic.cshtml b/Project-Unite/Views/Forum/ViewTopic.cshtml new file mode 100644 index 0000000..4348518 --- /dev/null +++ b/Project-Unite/Views/Forum/ViewTopic.cshtml @@ -0,0 +1,69 @@ +@model Project_Unite.Models.ForumTopic +@using Microsoft.AspNet.Identity +@{ + ViewBag.Title = Model.Subject; +} + +@if(ViewBag.Error != null) +{ + <div class="panel panel-error"> + <div class="panel-body"> + <p><span class="glyphicon glyphicon-exclamation-sign"></span> @ViewBag.Error</p> + </div> + </div> +} + +@if(Model.IsUnlisted == true) +{ + <div class="panel panel-warning"> + <div class="panel-body"> + <p><span class="glyphicon glyphicon-eye-close"></span> <strong>This topic is unlisted.</strong> Only those with the topic link as well as moderators may see this topic. Please respect its privacy.</p> + </div> + </div> +} + +<h2>@Model.Subject</h2> + +<p>Started by <strong>@Html.UserLink(Model.AuthorId)</strong> at <strong>@Model.StartedAt</strong></p> + +@{ + Html.RenderPartial("~/Views/Shared/_ModeratorBar.cshtml", Model); +} + +@foreach (var post in Model.Posts.OrderBy(x => x.PostedAt)) +{ + <div class="row panel panel-default"> + <div class="panel-body"> + <div class="col-xs-4"> <!--Mini profile data--> + <img src="@ACL.GetUserInfo(post.AuthorId).AvatarUrl" width="128" height="128" /><br/> + <strong>@Html.UserLink(post.AuthorId)</strong><br/> + @{ + var user = ACL.GetUserInfo(post.AuthorId); + <p><strong>@user.Codepoints</strong> Codepoints</p> + <p><strong><u>@user.HighestRole.Name</u></strong></p> + <p> + @if (ACL.Granted(User.Identity.Name, "CanAccessModCP")) + { + if (ACL.Granted(User.Identity.Name, "CanViewUserInfo")) + { + @Html.ActionLink("User info", "UserDetails", "Moderator", new { id = ACL.UserNameRaw(post.AuthorId) }, new { @class = "btn btn-default" }) + } + } + </p> + } + </div> + <div class="col-xs-8"><!--Post body, subject, author, time--> + <h4>@Model.Subject</h4> + <p>@Html.UserLink(post.AuthorId) at @post.PostedAt</p> + <p>@Html.Markdown(post.Body)</p> + @{ + Html.RenderPartial("~/Views/Shared/_PostModerationBar.cshtml", post); + } + </div> + </div> + </div> +} + +@{ + Html.RenderPartial("~/Views/Shared/_ModeratorBar.cshtml", Model); +} |
