mirror of https://github.com/calzoneman/sync.git
Merge pull request #596 from Xaekai/acpnav
Move ACP nav entry to templating
This commit is contained in:
commit
5e399b96cf
|
@ -2,7 +2,7 @@
|
|||
"author": "Calvin Montgomery",
|
||||
"name": "CyTube",
|
||||
"description": "Online media synchronizer and chat",
|
||||
"version": "3.18.4",
|
||||
"version": "3.18.5",
|
||||
"repository": {
|
||||
"url": "http://github.com/calzoneman/sync"
|
||||
},
|
||||
|
|
|
@ -38,6 +38,7 @@ function getBaseUrl(res) {
|
|||
function sendPug(res, view, locals) {
|
||||
locals.loggedIn = locals.loggedIn || !!res.user;
|
||||
locals.loginName = locals.loginName || res.user ? res.user.name : false;
|
||||
locals.superadmin = locals.superadmin || res.user ? res.user.global_rank >= 255 : false;
|
||||
if (!(view in cache) || Config.get("debug")) {
|
||||
var file = path.join(templates, view + ".pug");
|
||||
var fn = pug.compile(fs.readFileSync(file), {
|
||||
|
|
|
@ -22,6 +22,7 @@ html(lang="en")
|
|||
ul.dropdown-menu
|
||||
li: a(href="#" onclick="javascript:chatOnly()") Chat Only
|
||||
li: a(href="#" onclick="javascript:removeVideo(event)") Remove Video
|
||||
+navsuperadmin(true)
|
||||
+navloginlogout(cname)
|
||||
section#mainpage
|
||||
.container
|
||||
|
|
|
@ -11,6 +11,7 @@ html(lang="en")
|
|||
#nav-collapsible.collapse.navbar-collapse
|
||||
ul.nav.navbar-nav
|
||||
+navdefaultlinks("/")
|
||||
+navsuperadmin(false)
|
||||
+navloginlogout("/")
|
||||
section#mainpage
|
||||
.container
|
||||
|
|
|
@ -36,6 +36,13 @@ mixin navdefaultlinks(page)
|
|||
li: a(href=loginDomain+"/login?dest=" + encodeURIComponent(baseUrl + page)) Login
|
||||
li: a(href=loginDomain+"/register") Register
|
||||
|
||||
mixin navsuperadmin(newTab)
|
||||
if superadmin
|
||||
if newTab
|
||||
li: a(href="/acp", target="_blank") ACP
|
||||
else
|
||||
li: a(href="/acp") ACP
|
||||
|
||||
mixin navloginlogout(redirect)
|
||||
if loggedIn
|
||||
+navlogoutform(redirect)
|
||||
|
|
|
@ -369,10 +369,6 @@ Callbacks = {
|
|||
CLIENT.rank = r;
|
||||
handlePermissionChange();
|
||||
if(SUPERADMIN && $("#setrank").length == 0) {
|
||||
$("<a/>").attr("href", "/acp")
|
||||
.attr("target", "_blank")
|
||||
.text("ACP")
|
||||
.appendTo($("<li/>").appendTo($(".nav")[0]));
|
||||
var li = $("<li/>").addClass("dropdown")
|
||||
.attr("id", "setrank")
|
||||
.appendTo($(".nav")[0]);
|
||||
|
|
Loading…
Reference in New Issue