Admin panel sized textareas
This commit is contained in:
@@ -18,11 +18,11 @@ async function run() {
|
||||
item.append(id, username, permissions, edit, del);
|
||||
usersDiv.appendChild(item);
|
||||
edit.addEventListener("click", async () => {
|
||||
await fetch("/admin/edit/user", {method: "POST", body: JSON.stringify({"id": users[i][0], "username": username.value, "permissions": parseInt(permissions.value)})});
|
||||
await fetch("/admin/edit/user", { method: "POST", body: JSON.stringify({ "id": users[i][0], "username": username.value, "permissions": parseInt(permissions.value) }) });
|
||||
window.location.reload();
|
||||
})
|
||||
del.addEventListener("click", async () => {
|
||||
await fetch("/admin/delete/user", {method:"POST", body: JSON.stringify({"id": users[i][0]})});
|
||||
await fetch("/admin/delete/user", { method: "POST", body: JSON.stringify({ "id": users[i][0] }) });
|
||||
window.location.reload();
|
||||
})
|
||||
}
|
||||
@@ -30,7 +30,7 @@ async function run() {
|
||||
let players = await fetch("/admin/players").then(r => r.json());
|
||||
|
||||
let playersDiv = document.getElementById("players");
|
||||
for (let i=0; i<players.length; i++) {
|
||||
for (let i = 0; i < players.length; i++) {
|
||||
let item = document.createElement("div");
|
||||
let id = document.createElement("p");
|
||||
let name = document.createElement("input");
|
||||
@@ -44,11 +44,11 @@ async function run() {
|
||||
item.append(id, name, edit, del);
|
||||
playersDiv.appendChild(item);
|
||||
edit.addEventListener("click", async () => {
|
||||
await fetch("/admin/edit/player", {method: "POST", body: JSON.stringify({"id": players[i]["id"], "name": name.value})});
|
||||
await fetch("/admin/edit/player", { method: "POST", body: JSON.stringify({ "id": players[i]["id"], "name": name.value }) });
|
||||
window.location.reload();
|
||||
})
|
||||
del.addEventListener("click", async () => {
|
||||
await fetch("/admin/delete/player", {method:"POST", body: JSON.stringify({"id": players[i]["id"]})});
|
||||
await fetch("/admin/delete/player", { method: "POST", body: JSON.stringify({ "id": players[i]["id"] }) });
|
||||
window.location.reload();
|
||||
})
|
||||
}
|
||||
@@ -62,7 +62,7 @@ async function run() {
|
||||
item.append(name, save);
|
||||
playersDiv.appendChild(item);
|
||||
save.addEventListener("click", async () => {
|
||||
await fetch("/admin/new/player", {method:"POST", body: JSON.stringify({"name": name.value})})
|
||||
await fetch("/admin/new/player", { method: "POST", body: JSON.stringify({ "name": name.value }) })
|
||||
window.location.reload();
|
||||
})
|
||||
})
|
||||
@@ -74,7 +74,7 @@ async function run() {
|
||||
today.textContent = `Aujourd'hui il y a ${count.length} votes`;
|
||||
let votesDiv = document.getElementById("votes");
|
||||
|
||||
for (let i=0; i<votes.length; i++) {
|
||||
for (let i = 0; i < votes.length; i++) {
|
||||
let vote = votes[i];
|
||||
let item = document.createElement("div");
|
||||
item.style.display = "flex";
|
||||
@@ -98,28 +98,34 @@ async function run() {
|
||||
let minus_reason = document.createElement("textarea");
|
||||
minus_reason.value = vote["minus_reason"];
|
||||
minus_reason.style.whiteSpace = "pre-line";
|
||||
minus_reason.style.width = "500px";
|
||||
minus_reason.style.height = "200px";
|
||||
let edit = document.createElement("button");
|
||||
edit.textContent = "Edit";
|
||||
let del = document.createElement("button");
|
||||
del.textContent = "Delete";
|
||||
item.append(id,submit_date,plus_id,plus_nickname,plus_reason,minus_id,minus_nickname,minus_reason, edit, del);
|
||||
item.append(id, submit_date, plus_id, plus_nickname, plus_reason, minus_id, minus_nickname, minus_reason, edit, del);
|
||||
votesDiv.append(item);
|
||||
edit.addEventListener("click", async () => {
|
||||
await fetch("/admin/edit/vote", {method: "POST", body: JSON.stringify({"id": votes[i]["id"],
|
||||
await fetch("/admin/edit/vote", {
|
||||
method: "POST", body: JSON.stringify({
|
||||
"id": votes[i]["id"],
|
||||
"submit_date": submit_date.value,
|
||||
"plus_player_id": parseInt(plus_id.value),
|
||||
"plus_nickname": plus_nickname.value,
|
||||
"plus_reason": plus_reason.value,
|
||||
"minus_player_id": parseInt(minus_id.value),
|
||||
"minus_nickname": minus_nickname.value,
|
||||
"minus_reason": minus_reason.value})});
|
||||
"minus_reason": minus_reason.value
|
||||
})
|
||||
});
|
||||
window.location.reload();
|
||||
})
|
||||
del.addEventListener("click", async () => {
|
||||
await fetch("/admin/delete/vote", {method:"POST", body: JSON.stringify({"id": votes[i]["id"]})});
|
||||
await fetch("/admin/delete/vote", { method: "POST", body: JSON.stringify({ "id": votes[i]["id"] }) });
|
||||
window.location.reload();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
let _ = run();
|
||||
let _ = run();
|
||||
|
||||
Reference in New Issue
Block a user