2022-03-26 23:28:10 +03:00
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<% if (user?.admin){ %>
|
2022-08-26 16:27:29 +03:00
|
|
|
<div class="admin-bar">
|
2022-09-01 14:02:47 +03:00
|
|
|
<a href="/admin" class="admin-bar">You are admin, and you can go your page!</a>
|
2022-08-26 16:27:29 +03:00
|
|
|
</div>
|
2022-04-03 21:01:55 +03:00
|
|
|
|
|
|
|
<% } %>
|
|
|
|
|
2022-08-26 16:27:29 +03:00
|
|
|
<div class="header">
|
2022-09-09 15:34:12 +03:00
|
|
|
<a class="logo" href="/"><%= forum_name.toUpperCase() %> <span>FORUM</span></a>
|
2022-09-01 14:02:47 +03:00
|
|
|
<div class="buttons">
|
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<% if (user){ %>
|
2022-09-01 14:02:47 +03:00
|
|
|
<a href="<%=user.getLink() %>" class="btn-outline-primary">
|
|
|
|
<div class="box-username"><%= user.name %>
|
|
|
|
<div class="avatar"><img src="<%=user.avatar %>"></div>
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
<a id="logout" href="/login" class="btn-primary">Logout</a>
|
2022-08-26 16:27:29 +03:00
|
|
|
<% } else { %>
|
2022-09-01 14:02:47 +03:00
|
|
|
|
|
|
|
<a id="login" href="/login" class="btn-primary">Login</a>
|
|
|
|
<a href="/register" class="btn-outline-primary">Register</a>
|
|
|
|
<script>
|
|
|
|
document.getElementById("login").href += "?redirect=" + window.location.pathname;
|
|
|
|
</script>
|
|
|
|
<% } %>
|
|
|
|
|
|
|
|
</div>
|
2022-03-26 23:28:10 +03:00
|
|
|
</div>
|
2022-08-26 16:27:29 +03:00
|
|
|
<div class="menu">
|
2022-09-01 16:23:46 +03:00
|
|
|
<a href="/threads/create/" class="menu-item">Create Thread</a>
|
2022-09-09 20:47:28 +03:00
|
|
|
<a href="/categories" class="menu-item">Categories</a>
|
2022-09-01 14:02:47 +03:00
|
|
|
<a href="/threads" class="menu-item">Threads</a>
|
|
|
|
<a href="/users" class="menu-item">Users</a>
|
|
|
|
<a href="/search" class="menu-item">Search</a>
|
|
|
|
<script>
|
2022-08-26 16:27:29 +03:00
|
|
|
const menuItems = document.getElementsByClassName("menu-item");
|
|
|
|
|
2022-09-01 14:02:47 +03:00
|
|
|
for (let i = 0; i < menuItems.length; i++)
|
2022-09-01 16:23:46 +03:00
|
|
|
if (window.location.pathname.includes(menuItems[i].getAttribute("href"))) {
|
2022-09-01 14:02:47 +03:00
|
|
|
menuItems[i].classList.add("active-menu");
|
2022-09-01 16:23:46 +03:00
|
|
|
break;
|
|
|
|
}
|
2022-09-01 14:02:47 +03:00
|
|
|
</script>
|
2022-08-26 16:27:29 +03:00
|
|
|
</div>
|