Moderator user interface revamp.

This commit is contained in:
Michael 2017-05-22 14:37:11 -04:00
parent e581156480
commit 0942196366
2 changed files with 45 additions and 14 deletions

View file

@ -14,9 +14,9 @@ namespace Project_Unite.Controllers
public class ModeratorController : Controller public class ModeratorController : Controller
{ {
// GET: Moderator // GET: Moderator
public ActionResult Index() public ActionResult Index(string id = "home")
{ {
ViewBag.Moderator = true; ViewBag.Page = id;
return View(); return View();
} }
@ -31,7 +31,7 @@ public ActionResult UserDetails(string id)
public ActionResult Users() public ActionResult Users()
{ {
return View(new ApplicationDbContext().Users); return Index("users");
} }
public ActionResult Unban(string id, string returnUrl = "") public ActionResult Unban(string id, string returnUrl = "")
@ -211,20 +211,12 @@ public ActionResult Unlist(string id)
public ActionResult Bans() public ActionResult Bans()
{ {
var model = new ModeratorBanListViewModel(); return Index("bans");
var db = new ApplicationDbContext();
model.UserBans = db.Users.Where(x => x.IsBanned == true);
model.IPBans = db.BannedIPs;
return View(model);
} }
public ActionResult Logs() public ActionResult Logs()
{ {
var db = new ApplicationDbContext(); return Index("logs");
return View(db.AuditLogs.Where(x => x.Level != AuditLogLevel.Admin));
} }
public ActionResult Mute(string id, string returnUrl = "") public ActionResult Mute(string id, string returnUrl = "")

View file

@ -1,7 +1,46 @@
 @using Project_Unite.Models
@{ @{
ViewBag.Title = "Moderator CP"; ViewBag.Title = "Moderator CP";
string homeclass = (ViewBag.Page == "home") ? "active" : "";
string usersclass = (ViewBag.Page == "users") ? "active" : "";
string bansclass = (ViewBag.Page == "bans") ? "active" : "";
string logsclass = (ViewBag.Page == "logs") ? "active" : "";
var db = new ApplicationDbContext();
var users = db.Users;
var bans = new ModeratorBanListViewModel();
bans.IPBans = db.BannedIPs;
bans.UserBans = db.Users.Where(x => x.IsBanned == true);
var logs = db.AuditLogs.Where(x => x.Level != AuditLogLevel.Admin);
} }
<h2>Moderator Control Panel</h2>
<p>Perform your moderative tasks here. Just, don't go rogue!</p>
<div class="row">
<div class="col-xs-4">
<h4>Places</h4>
<ul id="tabs" data-tabs="tabs" class="nav nav-stacked nav-pills">
<li class="@homeclass"><a data-toggle="tab" href="#m_home"><span class="glyphicon glyphicon-home"></span> Home</a></li>
<li class="@usersclass"><a data-toggle="tab" href="#m_users"><span class="glyphicon glyphicon-user"></span> Users</a></li>
<li class="@bansclass"><a data-toggle="tab" href="#m_bans"><span class="glyphicon glyphicon-ban-circle"></span> Bans</a></li>
<li class="@logsclass"><a data-toggle="tab" href="#m_logs"><span class="glyphicon glyphicon-list"></span> Logs</a></li>
</ul>
</div>
<div class="col-xs-8 tab-content">
<div class="tab-pane fade in @homeclass" id="m_home">
<h4>Not yet implemented.</h4>
<p>Please suggest things to be put here.</p>
</div>
<div class="tab-pane fade in @usersclass" id="m_users">
@Html.Partial("~/Views/Moderator/Users.cshtml", users);
</div>
<div class="tab-pane fade in @bansclass" id="m_bans">
@Html.Partial("~/Views/Moderator/Bans.cshtml", bans)
</div>
<div class="tab-pane fade in @logsclass" id="m_logs">
@Html.Partial("~/Views/Moderator/Logs.cshtml", logs)
</div>
</div>
</div>