From 7e54c9b3fad48c7bce1134f7937924f120f1999c Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 17 May 2017 09:52:57 -0400 Subject: More fixes, specifically with forum --- Project-Unite/Views/Forum/Index.cshtml | 28 ++++- Project-Unite/Views/Forum/ViewForum.cshtml | 171 ++++++----------------------- 2 files changed, 60 insertions(+), 139 deletions(-) (limited to 'Project-Unite/Views') diff --git a/Project-Unite/Views/Forum/Index.cshtml b/Project-Unite/Views/Forum/Index.cshtml index 8e26c24..b579eeb 100644 --- a/Project-Unite/Views/Forum/Index.cshtml +++ b/Project-Unite/Views/Forum/Index.cshtml @@ -2,12 +2,16 @@ @{ ViewBag.Title = "Forums"; + bool noForums = true; }

Welcome to the forums.

@foreach (var cat in Model) { + if (ACL.CanSee(User?.Identity?.Name, cat.Id)) + { + noForums = false; @@ -16,16 +20,21 @@ @foreach (var subcat in cat.Children) - { + { + if (ACL.CanSee(User?.Identity?.Name, subcat.Id)) + { - } + } + }
@cat.NameMost Recent Post
@Html.ActionLink(subcat.Name, "ViewForum", "Forum", new { id = subcat.Id }, null)

@subcat.Description

- @if(subcat.Children.Length > 0) + @if (subcat.Children.Length > 0) {

Subforums: - @foreach(var subfrm in subcat.Children) + @foreach (var subfrm in subcat.Children) { + if (ACL.CanSee(User?.Identity?.Name, subfrm.Id)) + { @Html.ActionLink(subfrm.Name, "ViewForum", "Forum", new { id = subfrm.Id }, null)  + } }

} @@ -34,6 +43,17 @@
+ } +} + +@if(noForums == true) +{ +
+
+

No forums to show! There are no forums that you have read access to. If you are a guest, please @Html.ActionLink("log in", "Login", "Account"). If not, please contact an admin.

+
+
} \ No newline at end of file diff --git a/Project-Unite/Views/Forum/ViewForum.cshtml b/Project-Unite/Views/Forum/ViewForum.cshtml index 01f1d01..e4b528f 100644 --- a/Project-Unite/Views/Forum/ViewForum.cshtml +++ b/Project-Unite/Views/Forum/ViewForum.cshtml @@ -5,160 +5,61 @@

@Model.Name

-@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" }) -} - +

@Model.Description

@if (Model.Children.Length > 0) { - - - - - - - - @foreach (var cat in Model.Children) +
+
Subforums
+
Topics
+
Posts
+
Most Recent Post
+
+ foreach (var cat in Model.Children) { - - - - - - + +
+
+ } -
SubforumsTopicsPostsMost Recent Post
@Html.ActionLink(cat.Name, "ViewForum", "Forum", new { id = cat.Id }, null) +
+
@Html.ActionLink(cat.Name, "ViewForum", "Forum", new { id = cat.Id }, null)

@cat.Description

-
+ +
@cat.Topics.Length -
}
@if (Model.Topics.Length > 0) { - - - - - - - @{ - 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) - { - - - - - - } - } - @foreach (var topic in topicsSorted) - { - - bool showTopic = true; - if (topic.IsUnlisted == true) - { - if (!ACL.Granted(User.Identity.Name, "CanSeeUnlistedTopics")) +
+
Topics
+
Posts
+
Most recent post
+
+ var topics = Model.Topics.Where(x => x.ShouldShow == true).OrderByDescending(x=>x.StartedAt).ThenByDescending(x=>x.Priority); + foreach(var topic in topics) { - showTopic = false; +
+
+ @Html.ActionLink(topic.Subject, "ViewTopic", "Forum", new { id = topic.Discriminator }, null) +
+

Started by @Html.UserLink(topic.AuthorId) at @topic.StartedAt • @topic.Likes.Length • @topic.Dislikes.Length

+
+
+ @topic.Posts.Length +
+
} - } - - if (showTopic == true) - { - - - - - - } - } - - -
TopicsPostsMost recent post
  - @if(topic.IsUnlisted == true) - { - - } - @if (topic.IsLocked == true) - { - - } - - @Html.ActionLink(topic.Subject, "ViewTopic", "Forum", new { id = topic.Discriminator }, null) -

Started by @Html.UserLink(topic.AuthorId) on @topic.StartedAt

-
- @topic.Posts.Length - - @if (topic.Posts.Length > 0) - { - var mostRecent = topic.Posts.OrderByDescending(x => x.PostedAt).First(); - Re: @topic.Subject - by @Html.UserLink(mostRecent.AuthorId) -

at @mostRecent.PostedAt

- } - else - { - No posts. - } -
- @if(topic.IsUnlisted == true) - { - - } - - @if (topic.IsLocked == true) - { - - } - @Html.ActionLink(topic.Subject, "ViewTopic", "Forum", new { id = topic.Discriminator }, null) -

Started by @Html.UserLink(topic.AuthorId) on @topic.StartedAt

-
- @topic.Posts.Length - - @if (topic.Posts.Length > 0) - { - var mostRecent = topic.Posts.OrderByDescending(x => x.PostedAt).First(); - Re: @topic.Subject - by @Html.UserLink(mostRecent.AuthorId) -

at @mostRecent.PostedAt

- } - else - { - No posts. - } -
} else { -- cgit v1.2.3