mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-26 13:20:41 +03:00
Added Admin panel buttons and alert for success
This commit is contained in:
parent
a0848f1225
commit
6b483c8d28
6 changed files with 18 additions and 8 deletions
|
@ -8,5 +8,5 @@ module.exports = (req, res) => {
|
||||||
|
|
||||||
if (!user.admin) return error(res, 404, "You have not got permissions for view to this page.");
|
if (!user.admin) return error(res, 404, "You have not got permissions for view to this page.");
|
||||||
|
|
||||||
res.render("admin", { user })
|
res.render("admin", { user, user2: false })
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ module.exports = (req, res) => {
|
||||||
user2.write()
|
user2.write()
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render("admin", { user })
|
res.render("admin", { user, user2 })
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,15 +27,19 @@
|
||||||
|
|
||||||
<!-- Navbar end -->
|
<!-- Navbar end -->
|
||||||
|
|
||||||
|
|
||||||
<h1>Welcome to the admin panel of the forum, <%= user.name %>!</h1>
|
<h1>Welcome to the admin panel of the forum, <%= user.name %>!</h1>
|
||||||
|
|
||||||
<form action="/admin/" method="POST">
|
<form action="/admin/" method="POST">
|
||||||
<h2>Write an ID for make admin:</h2>
|
<h2>Write an ID for make admin:</h2>
|
||||||
<input name="userid"></input>
|
<input name="userid"></input>
|
||||||
<hr>
|
<hr>
|
||||||
<button class = "buyuk" type="submit">Make admin!</button>
|
<button class="buyuk" type="submit">Make admin!</button>
|
||||||
</form>
|
</form>
|
||||||
|
<script>
|
||||||
|
if (<%= user2.admin %>)
|
||||||
|
alert("Making admin of '<%= user2.name %>'' is success");
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -14,6 +14,11 @@
|
||||||
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<%if(user.admin){%>
|
||||||
|
<button onclick="window.location.href = '/admin'">ADMIN PANEL</button> <hr>
|
||||||
|
|
||||||
|
<%};%>
|
||||||
<!-- Navbar: -->
|
<!-- Navbar: -->
|
||||||
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
|
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
|
||||||
<br> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button>
|
<br> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button>
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
<body>
|
<body>
|
||||||
<!-- Navbar: -->
|
<!-- Navbar: -->
|
||||||
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
|
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
|
||||||
<br> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button>
|
<br>
|
||||||
|
|
||||||
<button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button>
|
<button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button>
|
||||||
<button class="buyuk" onclick="window.location.href = '/users'">USERS</button>
|
<button class="buyuk" onclick="window.location.href = '/users'">USERS</button>
|
||||||
|
<button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button>
|
||||||
<h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a>
|
<h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a>
|
||||||
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
|
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
|
@ -17,8 +17,9 @@
|
||||||
<!-- Navbar: -->
|
<!-- Navbar: -->
|
||||||
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
|
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
|
||||||
<br>
|
<br>
|
||||||
<button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button>
|
|
||||||
<button class="buyuk" onclick="window.location.href = '/users'">USERS</button>
|
<button class="buyuk" onclick="window.location.href = '/users'">USERS</button>
|
||||||
|
<button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button>
|
||||||
|
|
||||||
<button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button>
|
<button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button>
|
||||||
<h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a>
|
<h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a>
|
||||||
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
|
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
|
||||||
|
|
Loading…
Reference in a new issue