summaryrefslogtreecommitdiff
path: root/Project-Unite/Views/Moderator
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-11 10:14:48 -0400
committerMichael <[email protected]>2017-05-11 10:14:48 -0400
commitdbce55459fae3568c3cd69562b5fe37bc7493d1c (patch)
tree8afedb1f12cef77acd4bf436d2b6e7f3b01eb96b /Project-Unite/Views/Moderator
parent7e0dfbb778197ea4dc8205711ea96d87d24d1c95 (diff)
downloadproject-unite-dbce55459fae3568c3cd69562b5fe37bc7493d1c.tar.gz
project-unite-dbce55459fae3568c3cd69562b5fe37bc7493d1c.tar.bz2
project-unite-dbce55459fae3568c3cd69562b5fe37bc7493d1c.zip
Jesus.
*looks at the atmosphere with major thoights of the mess he has created*
Diffstat (limited to 'Project-Unite/Views/Moderator')
-rw-r--r--Project-Unite/Views/Moderator/UserDetails.cshtml44
1 files changed, 31 insertions, 13 deletions
diff --git a/Project-Unite/Views/Moderator/UserDetails.cshtml b/Project-Unite/Views/Moderator/UserDetails.cshtml
index 74556df..8a550cb 100644
--- a/Project-Unite/Views/Moderator/UserDetails.cshtml
+++ b/Project-Unite/Views/Moderator/UserDetails.cshtml
@@ -10,22 +10,22 @@
<ul>
<li><strong>Email address: </strong><a href="mailto:@Model.Email">Email @Model.Email</a></li>
- <li><strong>Display name: </strong>@Model.DisplayName
+ <li><strong>Display name: </strong> <div id="[email protected]">@Model.DisplayName</div>
- @if (ACL.Granted(User.Identity.Name, "CanEditUsernames"))
+ @if (User.Identity.IsAdmin())
{
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>
+ <a data-toggle="modal" data-target="#[email protected]" href="#"><span class="glyphicon glyphicon-pencil"></span> Change</a>
<!-- Modal -->
- <div id="edit-user" class="modal fade" role="dialog">
+ <div id="[email protected]" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
- @using (Html.BeginForm("ChangeUsername", "Moderator", new { id = Model.Id }))
+ @using (Html.BeginForm("ChangeUsername", "Moderator", new { id = Model.Id }, FormMethod.Post, new { name = "changeusername_" + Model.Id }))
{
@Html.AntiForgeryToken()
<div class="modal-header">
@@ -34,11 +34,10 @@
</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>
-
+ <p><strong>@Html.DisplayNameFor(Model => Model.DisplayName)</strong>: @Html.TextBoxFor(Model => Model.DisplayName, new { id="new_username_" + Model.Id, @class = "form-control" })</p>
</div>
<div class="modal-footer">
- <input type="submit" value="Change" class="btn btn-primary" />
+ <a class="btn btn-primary" data-dismiss="modal" href="#" id="[email protected]"><span class="glyphicon glyphicon-ok"></span> Change</a>
<a href="#" data-dismiss="modal" class="btn btn-default">Cancel</a>
</div>
}
@@ -49,10 +48,7 @@
}
}
</li>
- @if(ACL.Granted(User.Identity.Name, "CanIssueIPBan"))
- {
- <li><strong>Last known IP address: </strong>@Model.LastKnownIPAddress</li>
- }
+ <li><strong>Last known IP address: </strong>@Model.LastKnownIPAddress</li>
<li><strong>Banned: </strong>
@if (Model.IsBanned)
{
@@ -111,6 +107,28 @@
<strong>Hobbies:</strong>
<p>@Model.Hobbies</p>
</li>
+</ul>
+<a data-toggle="modal" href="#" data-target="#[email protected]" id="[email protected]" class="hidden">I'm a callback.</a>
-</ul> \ No newline at end of file
+<script type="text/javascript">
+ $('#[email protected]').click(function (e) { //Never gets called.
+ e.preventDefault();
+ $.ajax({
+ type: 'GET',
+ cache: true,
+ url: './Moderator/ChangeUsername/@Model.Id?newName=' + encodeURIComponent($('#[email protected]').val()),
+ success: function (msg) {
+ $.ajax({
+ type: "GET",
+ cache: true,
+ url: "./Moderator/GetUsername/@Model.Id",
+ success: function (result) {
+ $('#[email protected]').val(result);
+ $('#[email protected]').val(result);
+ }
+ });
+ }
+ });
+ });
+</script> \ No newline at end of file