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/_ModeratorBar.cshtml | |
| 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/_ModeratorBar.cshtml')
| -rw-r--r-- | Project-Unite/Views/Shared/_ModeratorBar.cshtml | 133 |
1 files changed, 133 insertions, 0 deletions
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 |
