summaryrefslogtreecommitdiff
path: root/Project-Unite/Views/Wiki/Index.cshtml
blob: 3cebce7daa9dac001df52d2812d70ea6dc1fbd43 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
@model Project_Unite.Models.WikiViewModel

@{
    if (Model.Page == null)
    {
        ViewBag.Title = "Wiki";
    }
    else
    {
        ViewBag.Title = Model.Page.Name + " - Wiki";
    }
}

@helper CreateCategoryListRecursive(Project_Unite.Models.WikiCategory category) { 
    <li>@category.Name
        <ul>
            @foreach(var cat in category.Children)
            {
                @CreateCategoryListRecursive(cat);
            }
            @foreach(var page in category.Pages)
            {
                <li>@Html.ActionLink(page.Name, "Index", "Wiki", new { id = page.Id }, null)</li>
            }
        </ul>
    </li>
}

@if (!string.IsNullOrWhiteSpace(ViewBag.Error))
{
    <div class="panel panel-danger">
        <div class="panel-body">
            <p><span class="glyphicon glyphicon-exclamation-sign"></span> @ViewBag.Error</p>
        </div>
    </div>
}

@if (Request.IsAuthenticated)
{
    <ul class="nav nav-tabs">
        <li><a href="@Url.Action("AddPage")"><span class="glyphicon glyphicon-plus"></span> Add new page.</a></li>
    </ul>
}

<div class="row">
    <div class="col-xs-4 panel">
        <div class="panel-body">
            <h4>Pages</h4>

            <ul>
                <li>@Html.ActionLink("Index", "Index")</li>
                <li>@Html.ActionLink("Random page", "Random")</li>

                @foreach(var cat in Model.Categories)
                {
                    @CreateCategoryListRecursive(cat);
                }
            </ul>
        </div>
    </div>

    <div class="col-xs-8 panel">
        <div class="panel-body">
            @if (Model.Page != null)
            {
                <h1>@Model.Page.Name</h1>

                if(Model.Page.AmbiguousReferences.Length > 0)
                {
                    <p>Ambiguity detected. Here's a list of pages that may relate to this page.</p>

                    <ul>
                        @foreach(var page in Model.Page.AmbiguousReferences)
                        {
                            <li>@Html.ActionLink(page.Name, "Index", new { id = page.Id })</li>
                        }
                    </ul>
                }

                var edit = Model.Page.EditHistory.First();

                    <p><strong>Last edited by @Html.UserLink(edit.UserId) on @edit.EditedAt</strong></p>

                if (Request.IsAuthenticated)
                {
                    <ul class="nav nav-pills">
                        <li><a href="@Url.Action("EditPage", new { id = Model.Page.Id })"><span class="glyphicon glyphicon-pencil"></span> Edit this page</a></li>
                    </ul>
                }

                <p>@Html.Markdown(Model.Page.Contents)</p>

                if (Request.IsAuthenticated)
                {
                    <ul class="nav nav-pills">
                        <li>Was this page helpful?</li>
                        <li><a href="@Url.Action("LikePage", new { id = Model.Page.Id })"><span class="glyphicon glyphicon-thumbs-up"></span> @Model.Page.Likes.Length</a></li>
                        <li><a href="@Url.Action("DislikePage", new { id = Model.Page.Id })"><span class="glyphicon glyphicon-thumbs-down"></span> @Model.Page.Dislikes.Length</a></li>

                    </ul>
                }
            }
            else
            {
                <h1>ShiftOS Wiki</h1>

                <p>The ShiftOS Wiki is a community and developer-driven handbook for everything you need to know about ShiftOS. It contains tutorials, guides, code examples, and loads of other interesting things. Read on!</p>

                <h3>How to post to and edit the wiki</h3>

                <p>If you have a ShiftOS account, and have the right privileges to a category, simply click the "Add new page" button at the top, and fill in the blanks.</p>

                <p>If you don't have a ShiftOS account, this is the perfect time to @Html.ActionLink("create one", "Register", "Account")! Without one, how would you play the game?</p>

                <h3>Adding categories</h3>

                <p>Adding categories is only available to those with the `CanManageWikiCategories` access control definition. If you have this ACL definition, you may manage wiki categories from the Developer Control Panel.</p>

                <h3>This wiki supports Markdown!</h3>

                <p>You can use Markdown in the wiki, just like you would in a forum post, skin description or user status update. We use the CommonMark standard - which is the standard used by websites and software like GitHub, Discourse, Gitter, and various others.</p>


            }
        </div>
    </div>
</div>