mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-26 05:10:41 +03:00
Update user.ejs
This commit is contained in:
parent
14bf6d45a4
commit
8b91d8d182
1 changed files with 96 additions and 82 deletions
178
views/user.ejs
178
views/user.ejs
|
@ -3,95 +3,109 @@
|
||||||
|
|
||||||
<%- include("extra/meta", {title: member.name }) %>
|
<%- include("extra/meta", {title: member.name }) %>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/css/user.css" />
|
||||||
|
|
||||||
<body style="text-align: center;">
|
<body >
|
||||||
<%- include("extra/navbar") %>
|
<%- include("extra/navbar") %>
|
||||||
|
|
||||||
<ul>
|
<div class="content">
|
||||||
<li>
|
<div class="box" style="justify-content:center;">
|
||||||
<h1 style="color: #4d18e6;">Avatar:</h1>
|
<img style="width:100px;height:100px;border-radius:50%;" src="<%=member.avatar %>">
|
||||||
<img style="width:256px;height:256px;" src="<%=member.avatar %>">
|
</div>
|
||||||
</li>
|
<div class="box">
|
||||||
|
<h2 class="box-title">Name: <%= member.name %>
|
||||||
|
</h2>
|
||||||
|
<h2 class="box-title">
|
||||||
|
<%= member.name %>
|
||||||
|
</h2>
|
||||||
|
|
||||||
<li>
|
</div>
|
||||||
<h2 style="color: #606060;">Name: <%= member.name %>
|
|
||||||
</h2>
|
<div class="box">
|
||||||
</li>
|
<h2 class="box-title">Created at:
|
||||||
<li>
|
</h2>
|
||||||
<h2 style="color: #606060;">Created at:
|
<h2 class="box-title">
|
||||||
<%= new Date(member.time).toLocaleString() %>
|
<%= new Date(member.time).toLocaleString() %>
|
||||||
</h2>
|
</h2>
|
||||||
|
</div>
|
||||||
|
<div class="box">
|
||||||
|
|
||||||
|
<h2 class="box-title">Is admin?
|
||||||
|
</h2>
|
||||||
|
<h2 class="box-title">
|
||||||
|
<%= member.admin ? "Yes" : "No" %>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
|
||||||
|
<h2 class="box-title"> Message:
|
||||||
|
</h2>
|
||||||
|
<h2 class="box-title">
|
||||||
|
<%= counts.message %>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<div class="box">
|
||||||
|
|
||||||
|
<h2 class="box-title"> Thread:
|
||||||
|
</h2>
|
||||||
|
<h2 class="box-title">
|
||||||
|
<%= counts.thread %>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% if (user?.admin && !member.deleted) {%>
|
||||||
|
<a class="big" id="admin">Give admin permissions!</a>
|
||||||
|
|
||||||
|
<a class="big" id="delete">Delete user!</a>
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
|
||||||
|
import request from "../../js/request.js";
|
||||||
|
document.addEventListener("click", async e => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (e.target.id == "admin") {
|
||||||
|
|
||||||
|
const response = await request("/api/users/<%= member.id %>/admin");
|
||||||
|
|
||||||
|
if (response.admin)
|
||||||
|
return alert("Making admin of " + response.name + " is success!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await request("/api/users/<%= member.id %>/delete");
|
||||||
|
|
||||||
|
if (!response.deleted) return
|
||||||
|
alert("User is deleted!");
|
||||||
|
location.reload()
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
</li>
|
</script>
|
||||||
<li>
|
<% }; %>
|
||||||
<h2 style="color: #606060;">Is admin? <%= member.admin ? "Yes" : "No" %>
|
<% if (member.deleted) {%>
|
||||||
</h2>
|
<h1>This user has been deleted!</h1>
|
||||||
</li>
|
<a onclick="undelete();" type="">Undelete user! </a>
|
||||||
|
|
||||||
<li>
|
|
||||||
<h2 style="color: #606060;"> Message: <%= counts.message %>
|
|
||||||
</h2>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<h2 style="color: #606060;"> Thread: <%= counts.thread %>
|
|
||||||
</h2>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<% if (user?.admin && !member.deleted) {%>
|
|
||||||
<a class="big" id="admin">Give admin permissions!</a>
|
|
||||||
|
|
||||||
<a class="big" id="delete">Delete user!</a>
|
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
import request from "../../js/request.js";
|
import request from "../../js/request.js";
|
||||||
document.addEventListener("click", async e => {
|
async function undelete(params) {
|
||||||
e.preventDefault();
|
|
||||||
if (e.target.id == "admin") {
|
const response = await request("/api/users/<%= member.id %>/undelete");
|
||||||
|
|
||||||
const response = await request("/api/users/<%= member.id %>/admin");
|
if (response.deleted) return;
|
||||||
|
alert("User is undeleted successfully!");
|
||||||
if (response.admin)
|
|
||||||
return alert("Making admin of " + response.name + " is success!");
|
|
||||||
|
|
||||||
} else if (e.target.id == "delete") {
|
|
||||||
|
|
||||||
const response = await request("/api/users/<%= member.id %>/delete");
|
|
||||||
|
|
||||||
if (!response.deleted) return;
|
|
||||||
alert("User is deleted!");
|
|
||||||
location.reload()
|
location.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
<% if (member.deleted) {%>
|
</body>
|
||||||
<h1>This user has been deleted!</h1>
|
|
||||||
<a onclick="undelete();" type="">Undelete user! </a>
|
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
||||||
<script type="module">
|
|
||||||
|
|
||||||
import request from "../../js/request.js";
|
|
||||||
async function undelete(params) {
|
|
||||||
|
|
||||||
const response = await request("/api/users/<%= member.id %>/undelete");
|
|
||||||
|
|
||||||
if (response.deleted) return;
|
|
||||||
alert("User is undeleted successfully!");
|
|
||||||
location.reload()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<% }; %>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
Loading…
Reference in a new issue