aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2020-10-03 13:08:28 +0200
committerMarvin Borner2020-10-03 13:08:28 +0200
commita6cd52452e504c23921bb0be32e883b9efd97da7 (patch)
tree3dd2d07131abbd5138b1a1d973780503004a746c
parent069e4d5a3bb03d4fcba46ae40657eb55b8581c53 (diff)
Frontend fixes
-rw-r--r--app.js4
-rw-r--r--mottovote/public/script.js10
-rw-r--r--overview/public/index.html4
-rw-r--r--quotes/public/script.js19
-rw-r--r--quotes/public/style.css10
5 files changed, 29 insertions, 18 deletions
diff --git a/app.js b/app.js
index 8200713..fcb7a8a 100644
--- a/app.js
+++ b/app.js
@@ -21,7 +21,7 @@ app.use(
resave: false,
saveUninitialized: true,
cookie: { secure: false },
- })
+ }),
);
app.use(express.urlencoded({ extended: true }));
@@ -29,7 +29,7 @@ app.use(express.json());
app.use("/", express.static(__dirname + "/overview/public"));
app.use("/motto", checkUser, motto);
-app.use("/mottovote", mottovote);
+app.use("/mottovote", checkUser, mottovote);
app.use("/quotes", checkUser, quotes);
app.use("/poll", checkUser, poll);
app.use("/auth", auth);
diff --git a/mottovote/public/script.js b/mottovote/public/script.js
index 05ca940..2a9f602 100644
--- a/mottovote/public/script.js
+++ b/mottovote/public/script.js
@@ -8,17 +8,17 @@ async function get() {
for (const motto of mottos) {
const row = document.createElement("div");
const id = motto.id;
-
+
for (let i = 0; i < maxVotes; i++) {
const cb = document.createElement("input");
cb.type = "checkbox";
cb.value = id;
- cb.checked = motto.votes && motto.votes-- > 0
+ cb.checked = motto.votes && motto.votes-- > 0;
row.append(cb);
}
-
+
const text = document.createElement("span");
- text.textContent = `${motto.name} ${motto.description ? "-" : ""} ${motto.description}`
+ text.textContent = `${motto.name} ${motto.description ? "-" : ""} ${motto.description}`;
row.append(text);
window.vote.appendChild(row);
@@ -50,4 +50,4 @@ function addListeners() {
if (res === "ok") location.reload();
else alert(res);
});
-} \ No newline at end of file
+}
diff --git a/overview/public/index.html b/overview/public/index.html
index 980e48e..98aa670 100644
--- a/overview/public/index.html
+++ b/overview/public/index.html
@@ -25,10 +25,10 @@
nutzen könnt:
</p>
<ul>
- <li><a href="/motto">Motto Wähler</a></li>
+ <!-- <li><a href="/motto">Motto Wähler</a></li> -->
+ <li><a href="/mottovote">Motto-Voting</a></li>
<li><a href="/quotes">Zitate</a></li>
<li><a href="/poll">Schüler-Ranking</a></li>
- <li><a href="/mottovote">Finales Mottovoting</a></li>
</ul>
<p>
Falls ihr uns bei der Entwicklung helfen wollt, Fehler gefunden habt oder Fragen an uns habt, könnt ihr
diff --git a/quotes/public/script.js b/quotes/public/script.js
index 8132019..a681e6d 100644
--- a/quotes/public/script.js
+++ b/quotes/public/script.js
@@ -19,19 +19,20 @@ function appendQuote(response) {
.getElementById(elem["class"])
.insertAdjacentHTML(
"beforeend",
- `<li>${elem["name"]} ${elem["middlename"] ? elem["middlename"] : " "}${elem["surname"]}: ${
+ `<li>${elem["name"]} ${elem["middlename"] ? elem["middlename"] : ""}${elem["surname"]}: ${
elem["quote"]
- }${elem["owner"] ? '<span data-id="' + elem["id"] + '">[Löschen]</span></li>' : ""}`,
+ }${elem["owner"] ? ' <span data-id="' + elem["id"] + '">[x]</span></li>' : ""}`,
);
const span = document.querySelector(`li span[data-id="${elem["id"]}"]`);
- if (span) span.addEventListener("click", (event) => {
- fetch("api/delete/" + event.target.getAttribute("data-id"), { method: "DELETE" })
- .then((response) => response.text())
- .then((response) => {
- if (response == "ok") event.target.parentNode.remove();
- });
- });
+ if (span)
+ span.addEventListener("click", (event) => {
+ fetch("api/delete/" + event.target.getAttribute("data-id"), { method: "DELETE" })
+ .then((response) => response.text())
+ .then((response) => {
+ if (response == "ok") event.target.parentNode.remove();
+ });
+ });
});
}
diff --git a/quotes/public/style.css b/quotes/public/style.css
index aac80ac..4ead1a1 100644
--- a/quotes/public/style.css
+++ b/quotes/public/style.css
@@ -34,6 +34,16 @@ button:not([type="submit"]) {
font-size: 15px;
}
+li {
+ word-wrap: break-word;
+}
+
+span {
+ float: right;
+ color: red;
+ cursor: pointer;
+}
+
input,
button,
select {