diff options
| author | Michael <[email protected]> | 2017-03-20 16:45:17 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-03-20 16:45:17 -0400 |
| commit | cdc61eb4ea5309769ad4db84d92594e4dc3dff67 (patch) | |
| tree | a8297a7aecc4376f07a497a5e02ab5ff165bfbd3 /Project-Unite/Views/Shared | |
| parent | d9f475e1f33bbf39ca0d79d7a6b0c2fd501b4f2d (diff) | |
| download | project-unite-cdc61eb4ea5309769ad4db84d92594e4dc3dff67.tar.gz project-unite-cdc61eb4ea5309769ad4db84d92594e4dc3dff67.tar.bz2 project-unite-cdc61eb4ea5309769ad4db84d92594e4dc3dff67.zip | |
Initial commit (azure deploy test)
Diffstat (limited to 'Project-Unite/Views/Shared')
| -rw-r--r-- | Project-Unite/Views/Shared/Error.cshtml | 9 | ||||
| -rw-r--r-- | Project-Unite/Views/Shared/Lockout.cshtml | 10 | ||||
| -rw-r--r-- | Project-Unite/Views/Shared/_Layout.cshtml | 162 | ||||
| -rw-r--r-- | Project-Unite/Views/Shared/_LoginPartial.cshtml | 40 | ||||
| -rw-r--r-- | Project-Unite/Views/Shared/_ModeratorBar.cshtml | 133 | ||||
| -rw-r--r-- | Project-Unite/Views/Shared/_PostModerationBar.cshtml | 27 |
6 files changed, 381 insertions, 0 deletions
diff --git a/Project-Unite/Views/Shared/Error.cshtml b/Project-Unite/Views/Shared/Error.cshtml new file mode 100644 index 0000000..be55b17 --- /dev/null +++ b/Project-Unite/Views/Shared/Error.cshtml @@ -0,0 +1,9 @@ +@model System.Web.Mvc.HandleErrorInfo + +@{ + ViewBag.Title = "Error"; +} + +<h1 class="text-danger">Error.</h1> +<h2 class="text-danger">An error occurred while processing your request.</h2> + diff --git a/Project-Unite/Views/Shared/Lockout.cshtml b/Project-Unite/Views/Shared/Lockout.cshtml new file mode 100644 index 0000000..8658ff2 --- /dev/null +++ b/Project-Unite/Views/Shared/Lockout.cshtml @@ -0,0 +1,10 @@ +@model System.Web.Mvc.HandleErrorInfo + +@{ + ViewBag.Title = "Locked Out"; +} + +<hgroup> + <h1 class="text-danger">Locked out.</h1> + <h2 class="text-danger">This account has been locked out, please try again later.</h2> +</hgroup> diff --git a/Project-Unite/Views/Shared/_Layout.cshtml b/Project-Unite/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..0e64010 --- /dev/null +++ b/Project-Unite/Views/Shared/_Layout.cshtml @@ -0,0 +1,162 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>@ViewBag.Title - My ASP.NET Application</title> + @Styles.Render("~/Content/css") + @Styles.Render("~/Content/bootstrap-theme.css") + @Styles.Render("~/Content/Site.css") + + + @Scripts.Render("~/bundles/modernizr") + +</head> +<body> + @Scripts.Render("~/Scripts/highlight.js") + <div class="navbar navbar-default navbar-fixed-top"> + <div> <!--Let's just add some padding there so the page doesn't look fucked.--> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + @Html.ActionLink("ShiftOS", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li>@Html.ActionLink("Home", "Index", "Home")</li> + <li>@Html.ActionLink("Download", "Download", "Home")</li> + <li class="dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle">Community <span class="caret"></span></a> + <ul class="dropdown-menu"> + <li>@Html.ActionLink("Discord", "Discord", "Home")</li> + <li>@Html.ActionLink("Forum", "Index", "Forum")</li> + <li>@Html.ActionLink("Wiki", "Index", "Wiki")</li> + <li>@Html.ActionLink("Developer blog", "Index", "Blog")</li> + <li>@Html.ActionLink("Bug tracker", "Index", "Bugs")</li> + <li><a href="http://github.com/shiftos-game/ShiftOS">GitHub</a></li> + </ul> + </li> + </ul> + @Html.Partial("_LoginPartial") + </div> + </div> + </div> + + @if (ViewBag.Modals != null) + { + + foreach (var id in ViewBag.Modals) + { + <div id="[email protected]" class="modal fade" role="dialog"> + <div class="modal-dialog"> + + <!-- Modal content--> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 class="modal-title">Are you sure?</h4> + </div> + <div class="modal-body"> + <p>Deleting this category will delete all child categories and topics associated with it. This <strong>cannot</strong> be undone.</p> + </div> + <div class="modal-footer"> + <a href="@id.Value" class="btn btn-primary">Yes</a> + <button type="button" class="btn btn-default" data-dismiss="modal">Nope.</button> + </div> + </div> + + </div> + </div> + + } + + } + + <div class="container clearfix body-content"> + @if (!ACL.UserEmailConfirmed(User.Identity.Name)) + { + <div class="panel panel-warning"> + <div class="panel-body"> + <span class="glyphicon glyphicon-info-sign"></span> <strong>Email address not confirmed!</strong> Hi! It appears that your email has not been confirmed. Please check your email. @Html.ActionLink("Resend confirmation link", "ResendConf", "Account") + </div> + </div> + } + + @if (ViewBag.Moderator == true) + { + <ul class="nav nav-tabs"> + <li>@Html.ActionLink("Home", "Index", "Moderator")</li> + @if (ACL.Granted(User.Identity.Name, "CanIssueBan")) + { + <li>@Html.ActionLink("Bans", "Bans", "Moderator")</li> + } + @if (ACL.Granted(User.Identity.Name, "CanEditProfiles")) + { + <li>@Html.ActionLink("Users", "Users", "Moderator")</li> + } + <li>@Html.ActionLink("Audit logs", "Logs", "Moderator")</li> + </ul> + @RenderBody(); + } + else if (ACL.Granted(User.Identity.Name, ViewBag.ACLRule)) + { + if (ViewBag.Admin == true) + { + if (ACL.Granted(User.Identity.Name, "CanAccessAdminCP")) + { + <ul class="nav nav-tabs"> + <li>@Html.ActionLink("Home", "Index", "Admin")</li> + @if (ACL.Granted(User.Identity.Name, "CanEditRoles")) + { + <li>@Html.ActionLink("Roles", "Roles", "Admin")</li> + <li>@Html.ActionLink("Access Control", "AccessControl", "Admin")</li> + + } + @if (ACL.Granted(User.Identity.Name, "CanEditProfiles")) + { + <li>@Html.ActionLink("Users", "Users", "Admin")</li> + } + @if (ACL.Granted(User.Identity.Name, "CanEditForumCategories")) + { + <li>@Html.ActionLink("Forum Categories", "Forums", "Admin")</li> + } + <li>@Html.ActionLink("Audit logs", "Logs", "Admin")</li> + </ul> + @RenderBody(); + } + else + { + <h2>Access denied.</h2> + <p>You do not have permission to access this page. Contact an admin if this is in error.</p> + } + } + else + { + @RenderBody() + + } + } + else + { + <h2>Access denied.</h2> + <p>You do not have permission to access this page. Contact an admin if this is in error.</p> + + }<hr /> + + <footer> + + <p>© @DateTime.Now.Year Michael VanOverbeek and the ShiftOS Dev Team</p> + @if (ACL.Granted(User.Identity.Name, "CanAccessAdminCP")) + { + <p>@Html.ActionLink("Administrator Control Panel", "Index", "Admin")</p> + } + </footer> + </div> + + @Scripts.Render("~/bundles/jquery") + @Scripts.Render("~/bundles/bootstrap") + @RenderSection("scripts", required: false) +</body> +</html> diff --git a/Project-Unite/Views/Shared/_LoginPartial.cshtml b/Project-Unite/Views/Shared/_LoginPartial.cshtml new file mode 100644 index 0000000..ad6978c --- /dev/null +++ b/Project-Unite/Views/Shared/_LoginPartial.cshtml @@ -0,0 +1,40 @@ +@using Microsoft.AspNet.Identity +@if (Request.IsAuthenticated) +{ + using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) + { + @Html.AntiForgeryToken() + + <ul class="nav navbar-nav navbar-right" style="margin-right:15px;"> + <li class="dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle"><span class="glyphicon glyphicon-user"></span> @Html.UserName(User.Identity.GetUserId()) <span class="caret"></span></a> + <ul class="dropdown-menu"> + <li><a href="@Url.Action("ViewProfile", "Profiles", new { name = User.Identity.Name })"><span class="glyphicon glyphicon-user"></span> Profile</a></li> + <li class="divider"></li> + <li class="dropdown-header">Settings</li> + @if(ACL.Granted(User.Identity.Name, "CanAccessAdminCP")) + { + <li><a href="@Url.Action("Index", "Admin")"><span class="glyphicon glyphicon-cog"></span> Admin CP</a></li> + } + @if (ACL.Granted(User.Identity.Name, "CanAccessModCP")) + { + <li><a href="@Url.Action("Index", "Moderator")"><span class="glyphicon glyphicon-warning-sign"></span> Mod CP</a></li> + } + @if (ACL.Granted(User.Identity.Name, "CanAccessDevCP")) + { + <li><a href="@Url.Action("Index", "Developer")"><span class="glyphicon glyphicon-star"></span> Developer CP</a></li> + } + <li><a href="@Url.Action("Index", "Manage")"><span class="glyphicon glyphicon-adjust"></span> Account</a></li> + <li class="divider"></li> + <li><a href="javascript:document.getElementById('logoutForm').submit()"><span class="glyphicon glyphicon-log-out"></span> Log off</a></li> + </ul> + </li> + </ul> + } +} +else +{ + <ul class="nav navbar-nav navbar-right" style="margin-right:15px;"> + <li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li> + <li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li> + </ul> +} diff --git a/Project-Unite/Views/Shared/_ModeratorBar.cshtml b/Project-Unite/Views/Shared/_ModeratorBar.cshtml new file mode 100644 index 0000000..8f8196e --- /dev/null +++ b/Project-Unite/Views/Shared/_ModeratorBar.cshtml @@ -0,0 +1,133 @@ +@using Microsoft.AspNet.Identity +@model Project_Unite.Models.ForumTopic + +@{ + string acl_perm_announce = "CanAnnounceTopics"; + string acl_perm_unlist = "CanUnlistTopics"; + string acl_perm_sticky = "CanStickyTopics"; + string acl_perm_global = "CanGlobalTopics"; + string acl_perm_unlock = "CanUnlockTopics"; + string acl_perm_lock = "CanLockTopics"; + + string like_link = Url.Action("Like", "Forum", new { id = Model.Discriminator }); + string dislike_link = Url.Action("Dislike", "Forum", new { id = Model.Discriminator }); + + if (User.Identity.GetUserId() == Model.AuthorId) + { + acl_perm_announce = "CanAnnounceOwnTopics"; + acl_perm_unlist = "CanUnlistOwnTopics"; + acl_perm_sticky = "CanStickyOwnTopics"; + acl_perm_global = "CanGlobalOwnTopics"; + acl_perm_unlock = "CanUnlockOwnTopics"; + acl_perm_lock = "CanLockOwnTopics"; + } + + +} + +<ul class="nav nav-tabs"> + <li><a href="@Url.Action("ViewForum", "Forum", new { id = Model.Parent })"><span class="glyphicon glyphicon-arrow-left"></span> Back</a></li> + @if (ACL.CanReply(User.Identity.Name, Model.Parent)) + { + if (Model.IsLocked == false) + { + <li><a href="@Url.Action("PostReply", "Forum", new { id = Model.Discriminator, fid = Model.Parent })"><span class="glyphicon glyphicon-comment"></span> Post reply</a></li> + } + else + { + <li> + <a data-toggle="modal" data-target="#m_locked" href="#"><span class="glyphicon glyphicon-lock"></span> Locked</a> + + <div class="modal fade in" id="m_locked"> + <div class="modal-content"> + <div class="modal-header"> + <a class="close" data-dismiss="modal"></a> + <h2>Locked</h2> + </div> + <div class="modal-body"> + <p>This topic is locked, you may not reply to it.</p> + @{ + string perm = "CanUnlockTopics"; + if (User.Identity.GetUserId() == Model.AuthorId) + { + perm = "CanUnlockOwnTopics"; + } + if (ACL.Granted(User.Identity.Name, perm)) + { + <p>If you would like to unlock this topic and allow replies, click the 'Moderation Tools' -> 'Unlock Topic' menu item at the top or bottom of the page.</p> + } + } + </div> + </div> + </div> + </li> + } + } + @if (ACL.Granted(User.Identity.Name, "CanAccessModCP")) + { + <li class="dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle">Moderator tools <span class="caret"></span></a> + <ul class="dropdown-menu" id="mtools"> + <li class="dropdown-header">Topic status</li> + @if (ACL.Granted(User.Identity.Name, acl_perm_sticky)) + { + <li>@Html.ActionLink("Make sticky", "StickyTopic", "Moderator", new { id = Model.Discriminator }, null)</li> + } + @if (ACL.Granted(User.Identity.Name, acl_perm_announce)) + { + <li>@Html.ActionLink("Announce", "AnnounceTopic", "Moderator", new { id = Model.Discriminator }, null)</li> + } + @if (ACL.Granted(User.Identity.Name, acl_perm_global)) + { + <li>@Html.ActionLink("Make global", "GlobalTopic", "Moderator", new { id = Model.Discriminator }, null)</li> + } + <li class="dropdown-header">Posting</li> + + @if (Model.IsLocked == true) + { + if (ACL.Granted(User.Identity.Name, acl_perm_unlock)) + { + <li> + @Html.ActionLink("Unlock topic", "Unlock", "Moderator", new { id = Model.Discriminator }, null) + </li> + } + } + else + { + if (ACL.Granted(User.Identity.Name, acl_perm_lock)) + { + <li> + @Html.ActionLink("Lock topic", "Lock", "Moderator", new { id = Model.Discriminator }, null) + </li> + } + + } +@if (Model.IsUnlisted == true) +{ + if (ACL.Granted(User.Identity.Name, acl_perm_unlist)) + { + <li> + @Html.ActionLink("Publish topic", "List", "Moderator", new { id = Model.Discriminator }, null) + </li> + } +} +else +{ + if (ACL.Granted(User.Identity.Name, acl_perm_unlist)) + { + <li> + @Html.ActionLink("Unlist topic", "Unlist", "Moderator", new { id = Model.Discriminator }, null) + </li> + } + +} + + + </ul> + </li> + } + <li><a href="@like_link"><span class="glyphicon glyphicon-thumbs-up"></span> @Model.Likes.Length</a></li> + <li><a href="@dislike_link"><span class="glyphicon glyphicon-thumbs-down"></span> @Model.Dislikes.Length</a></li> + +</ul> + +<hr/>
\ No newline at end of file diff --git a/Project-Unite/Views/Shared/_PostModerationBar.cshtml b/Project-Unite/Views/Shared/_PostModerationBar.cshtml new file mode 100644 index 0000000..a647447 --- /dev/null +++ b/Project-Unite/Views/Shared/_PostModerationBar.cshtml @@ -0,0 +1,27 @@ +@using Microsoft.AspNet.Identity +@model Project_Unite.Models.ForumPost + +@{ + string acl_perm_delete = "CanDeletePosts"; + string acl_perm_edit = "CanEditPosts"; + + if (User.Identity.GetUserId() == Model.AuthorId) + { + acl_perm_delete = "CanDeleteOwnPosts"; + acl_perm_edit = "CanEditOwnPosts"; + } +} + +<ul class="nav nav-tabs"> + @if(ACL.Granted(User.Identity.Name, acl_perm_edit)) + { + <li><a href="@Url.Action("EditPost", "Forum", new { id = Model.Id })"><span class="glyphicon glyphicon-pencil"></span> Edit</a></li> + } + @if (ACL.Granted(User.Identity.Name, acl_perm_delete)) + { + <li><a href="@Url.Action("DeletePost", "Forum", new { id = Model.Id })"><span class="glyphicon glyphicon-trash"></span> Delete</a></li> + } + +</ul> + +<hr/>
\ No newline at end of file |
