summaryrefslogtreecommitdiff
path: root/Project-Unite/Views/Forum/Index.cshtml
blob: b579eeb94731d055c7e09b1b368043ebcb940787 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
@model IEnumerable<Project_Unite.Models.ForumCategory>

@{
    ViewBag.Title = "Forums";
    bool noForums = true;
}

<h2>Welcome to the forums.</h2>

@foreach (var cat in Model)
{
    if (ACL.CanSee(User?.Identity?.Name, cat.Id))
    {
        noForums = false;
	<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)
        {
            if (ACL.CanSee(User?.Identity?.Name, subcat.Id))
            {
			<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)
                    {
                        if (ACL.CanSee(User?.Identity?.Name, subfrm.Id))
                        {
                        <em> @Html.ActionLink(subfrm.Name, "ViewForum", "Forum", new { id = subfrm.Id }, null)&nbsp;</em> 
                        }
                    }
                    </p>
                }
				</td>
				<td>@subcat.Topics.Length</td>
				<td></td>
				<td></td>
			</tr>
            }
        }
	</table>
    }
}

@if(noForums == true)
{
    <div class="panel panel-danger">
        <div class="panel-body">
            <p><span class="glyphicon glyphicon-ban-circle"></span> <strong>No forums to show!</strong> 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.</p>
        </div>
    </div>
}