summaryrefslogtreecommitdiff
path: root/Project-Unite/Views/Moderator/UserDetails.cshtml
blob: 74556dff6b22505b98155d6ed3a2439ac52d8719 (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
@model Project_Unite.Models.ApplicationUser
@{
    ViewBag.Moderator = true;
    ViewBag.Title = "User details";
}

<h2>User details</h2>

<h4>@Html.UserLink(Model.Id)</h4>

<ul>
    <li><strong>Email address: </strong><a href="mailto:@Model.Email">Email @Model.Email</a></li>
    <li><strong>Display name: </strong>@Model.DisplayName
    
    @if (ACL.Granted(User.Identity.Name, "CanEditUsernames"))
    {
        if (ACL.CanManageRole(User.Identity.Name, Model.HighestRole.Id))
        {
            <!-- Trigger the modal with a button -->
            <a data-toggle="modal" data-target="#edit-user" href="#"><span class="glyphicon glyphicon-pencil"></span> Change</a>

            <!-- Modal -->
            <div id="edit-user" class="modal fade" role="dialog">
                <div class="modal-dialog">

                    <!-- Modal content-->
                    <div class="modal-content">
                        @using (Html.BeginForm("ChangeUsername", "Moderator", new { id = Model.Id }))
                        {
                            @Html.AntiForgeryToken()
                            <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal">&times;</button>
                            <h4 class="modal-title">Change username</h4>
                        </div>
                        <div class="modal-body">
                                <p>Please enter a username for this user.</p>
                                <p><strong>@Html.DisplayNameFor(Model => Model.DisplayName)</strong>: @Html.TextBoxFor(Model => Model.DisplayName)</p>
                            
                        </div>
                        <div class="modal-footer">
                            <input type="submit" value="Change" class="btn btn-primary" /> 
                            <a href="#" data-dismiss="modal" class="btn btn-default">Cancel</a> 
                        </div>
                        }
                    </div>

                </div>
            </div>
        }
    }
    </li>
    @if(ACL.Granted(User.Identity.Name, "CanIssueIPBan"))
    {
        <li><strong>Last known IP address: </strong>@Model.LastKnownIPAddress</li>
    }
    <li><strong>Banned: </strong>
        @if (Model.IsBanned)
        {
            <em>Yes</em>
            if (Model.UserName != User.Identity.Name && ACL.CanManageRole(User.Identity.Name, Model.HighestRole.Id))
            {
         @Html.ActionLink("Unban", "Unban", "Moderator", new { id = Model.Id }, null)
            }
        }
        else
        {
            <em>No</em>
            if (Model.UserName != User.Identity.Name && ACL.CanManageRole(User.Identity.Name, Model.HighestRole.Id))
            {
            @Html.ActionLink("Ban", "Ban", "Moderator", new { id = Model.Id }, null)
            }
        }
    </li>
    @if(Model.IsBanned == true)
    {
        <li><strong>Banned on: </strong>@Model.BannedAt</li>
        <li><strong>Banned by: </strong>@Html.UserLink(Model.BannedBy)</li>
    }
    <li>
        <strong>Muted: </strong>
        @if (Model.IsMuted)
        {
            <em>Yes</em>
            if (Model.UserName != User.Identity.Name && ACL.CanManageRole(User.Identity.Name, Model.HighestRole.Id))
            {
            @Html.ActionLink("Unmute", "Unmute", "Moderator", new { id = Model.Id }, null)
            }
        }
        else
        {
            <em>No</em>
            if (Model.UserName != User.Identity.Name && ACL.CanManageRole(User.Identity.Name, Model.HighestRole.Id))
            {
            @Html.ActionLink("Mute", "Mute", "Moderator", new { id = Model.Id }, null)
            }
        }
    </li>
    @if (Model.IsMuted == true)
    {
        <li><strong>Muted on: </strong>@Model.MutedAt</li>
        <li><strong>Muted by: </strong>@Html.UserLink(Model.MutedBy)</li>
    }
    <li><strong>Bio:</strong>
        <p>@Html.Markdown(Model.Bio)</p>
    </li>
    <li>
        <strong>Interests:</strong>
        <p>@Model.Interests</p>
    </li>
    <li>
        <strong>Hobbies:</strong>
        <p>@Model.Hobbies</p>
    </li>


</ul>