akf-forum/views/user.ejs

76 lines
2.2 KiB
Text
Raw Normal View History

2022-03-13 16:16:46 +03:00
<!DOCTYPE html>
<html lang="en">
<%- include("extra/meta", {title: member.name }) %>
2022-03-26 23:28:10 +03:00
2022-08-28 19:03:32 +03:00
<body>
2022-08-28 18:10:41 +03:00
<link rel="stylesheet" href="/css/user.css" />
<%if (user) {%>
<script type="module">
import request from "../../js/request.js";
document.addEventListener("click", async e => {
if (e.target.id == "delete") {
const response = await request("/api/users/<%= member.id %>", "DELETE");
if (!response.deleted) return
alert("User is deleted!");
location.reload()
} else if (e.target.id == "undelete") {
const response = await request("/api/users/<%= member.id %>/undelete");
if (response.deleted) return;
alert("User is undeleted successfully!");
location.reload()
}
});
</script>
<% }; %>
2022-08-28 18:10:41 +03:00
<%- include("extra/navbar") %>
<div class="content">
<% if (user?.admin || user?.id === member.id) { %>
<a class="btn-outline-primary" href="<%= member.getLink() %>/edit">Edit user!</a>
<% } %>
<% if (member.deleted) {%>
<h1>This user has been deleted!</h1>
<a id="undelete" class="btn-primary">Undelete user! </a>
<% } else if (user?.admin){ %>
<a id="delete" class="btn-outline-primary">Delete user! </a>
<% }; %>
2022-08-28 18:10:41 +03:00
<div class="box" style="justify-content:center;">
<img style="width:100px;height:100px;border-radius:50%;" src="<%=member.avatar %>">
2022-08-28 18:10:41 +03:00
</div>
<div class="box">
2022-08-28 19:03:32 +03:00
<h2 class="box-title">Name:</h2>
2022-08-28 20:32:52 +03:00
<h2 class="box-value"><%= member.name %></h2>
2022-08-28 18:10:41 +03:00
</div>
<div class="box">
2022-08-28 20:32:52 +03:00
<h2 class="box-title">Created at:</h2>
<h2 class="box-value"><%= new Date(member.time).toLocaleString() %></h2>
</div>
2022-08-28 18:10:41 +03:00
<div class="box">
2022-08-28 20:32:52 +03:00
<h2 class="box-title">Is admin?</h2>
<h2 class="box-value"><%= member.admin ? "Yes" : "No" %></h2>
2022-08-28 18:10:41 +03:00
</div>
<div class="box">
<h2 class="box-title">Message:</h2>
2022-08-28 20:32:52 +03:00
<h2 class="box-value"><%= counts.message %></h2>
</div>
<div class="box">
<h2 class="box-title">Thread:</h2>
<h2 class="box-value"><%= counts.thread %></h2>
2022-08-28 18:10:41 +03:00
</div>
2022-08-29 19:31:59 +03:00
<div class="box">
<h2 class="box-title">About:</h2>
2022-08-29 19:31:59 +03:00
</div>
<p class="box-value">
<%= member.about %>
</p>
</div>
2022-08-28 18:10:41 +03:00
</body>
2022-03-13 16:16:46 +03:00
</html>