Added Admin panel buttons and alert for success

This commit is contained in:
Akif9748 2022-03-13 16:32:02 +03:00
parent a0848f1225
commit 6b483c8d28
6 changed files with 18 additions and 8 deletions

View file

@ -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 })
} }

View file

@ -16,7 +16,7 @@ module.exports = (req, res) => {
user2.write() user2.write()
} }
res.render("admin", { user }) res.render("admin", { user, user2 })
} }

View file

@ -27,6 +27,7 @@
<!-- 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">
@ -35,7 +36,10 @@
<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>

View file

@ -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>

View file

@ -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>

View file

@ -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 %>>