aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin/index.js7
-rw-r--r--admin/public/index.html7
-rw-r--r--admin/public/prediction.html28
-rw-r--r--admin/public/prediction.js11
-rw-r--r--prediction/public/index.html7
-rw-r--r--profile/public/script.js9
-rw-r--r--profile/public/style.css1
-rw-r--r--profile/public/user.js2
8 files changed, 66 insertions, 6 deletions
diff --git a/admin/index.js b/admin/index.js
index 46b4f16..7479a3e 100644
--- a/admin/index.js
+++ b/admin/index.js
@@ -74,4 +74,11 @@ app.get("/api/participation", checkAdmin, async (req, res) => {
res.json(participation);
});
+app.get("/api/prediction", checkAdmin, async (req, res) => {
+ const prediction = await db.query(
+ "SELECT u.name uname, u.middlename umid, u.surname usur, t.name tname, t.middlename tmid, t.surname tsur FROM users u INNER JOIN teacher_prediction p ON u.id = p.user_id INNER JOIN users t ON t.id = p.teacher_id",
+ );
+ res.json(prediction);
+});
+
module.exports = app;
diff --git a/admin/public/index.html b/admin/public/index.html
index 83d3a00..f2506f2 100644
--- a/admin/public/index.html
+++ b/admin/public/index.html
@@ -24,8 +24,11 @@
<ul class="pure-menu-list">
<li class="pure-menu-item"><a href="ranking.html" class="pure-menu-link">Ranking</a></li>
<li class="pure-menu-item"><a href="questions.html" class="pure-menu-link">Fragen</a></li>
-<!-- <li class="pure-menu-item"><a href="votes.html" class="pure-menu-link">Votes</a></li>-->
-<!-- <li class="pure-menu-item"><a href="participation.html" class="pure-menu-link">Teilnahme</a></li>-->
+ <li class="pure-menu-item">
+ <a href="prediction.html" class="pure-menu-link">Wo sieht mich mein Lehrer in 10 Jahren</a>
+ </li>
+ <!-- <li class="pure-menu-item"><a href="votes.html" class="pure-menu-link">Votes</a></li>-->
+ <!-- <li class="pure-menu-item"><a href="participation.html" class="pure-menu-link">Teilnahme</a></li>-->
</ul>
</div>
</div>
diff --git a/admin/public/prediction.html b/admin/public/prediction.html
new file mode 100644
index 0000000..99e35e3
--- /dev/null
+++ b/admin/public/prediction.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link
+ rel="stylesheet"
+ href="https://unpkg.com/purecss@2.0.3/build/pure-min.css"
+ integrity="sha384-cg6SkqEOCV1NbJoCu11+bm0NvBRc8IYLRGXkmNrqUBfTjmMYwNKPWBTIKyw9mHNJ"
+ crossorigin="anonymous"
+ />
+ <link rel="stylesheet" href="style.css" type="text/css" media="all" />
+
+ <title>Fragen</title>
+ </head>
+ <body>
+ <div class="pure-menu pure-menu-horizontal">
+ <a href="/" class="pure-menu-item pure-menu-link">Home</a>
+ <a href="/auth/api/logout" class="pure-menu-item pure-menu-link">Logout</a>
+ </div>
+ <div class="card">
+ <h2>Wo sieht mich mein Lehrer in 10 Jahren?</h2>
+ <ul id="list"></ul>
+ </div>
+
+ <script src="prediction.js"></script>
+ </body>
+</html>
diff --git a/admin/public/prediction.js b/admin/public/prediction.js
new file mode 100644
index 0000000..66afb06
--- /dev/null
+++ b/admin/public/prediction.js
@@ -0,0 +1,11 @@
+const list = document.getElementById("list");
+
+fetch("api/prediction")
+ .then((r) => r.json())
+ .then((r) => {
+ r.forEach((d) => {
+ const elem = document.createElement("li");
+ elem.innerText = `${d.uname} ${d.umid || ""} ${d.usur}: ${d.tname} ${d.tmid || ""} ${d.tsur}`;
+ list.appendChild(elem);
+ });
+ });
diff --git a/prediction/public/index.html b/prediction/public/index.html
index 46b920e..62b8b2e 100644
--- a/prediction/public/index.html
+++ b/prediction/public/index.html
@@ -22,7 +22,12 @@
<main>
<div class="pure-form pure-form-stacked">
<fieldset>
- <legend>Hier sieht mich mein Lehrer in 10 Jahren:</legend>
+ <legend>Hier sieht mich mein Lehrer in 10 Jahren</legend>
+ <p>
+ Hier kannst du eine/n Lehrer/in auswählen, der/die die Frage "Wo sieht mich mein Lehrer in 10
+ Jahren?" beantwortet (die Antworten holt dann das Abikomittee). Diese Antwort wird dann auf
+ deinem Steckbrief in der Abizeitung dargestellt.
+ </p>
<label for="prediction">Lehrer</label>
<select name="teacher" id="prediction"></select>
<button type="submit" class="pure-button pure-button-primary">Hinzufügen</button>
diff --git a/profile/public/script.js b/profile/public/script.js
index db9a277..a115b64 100644
--- a/profile/public/script.js
+++ b/profile/public/script.js
@@ -62,6 +62,7 @@ function appendQuestions(question) {
field.value = question.answer || "";
field.placeholder = question.question;
field.type = question.type;
+ field.maxLength = 100;
if (question.type === "file") {
imageID = question.id;
field.accept = "image/*";
@@ -95,8 +96,12 @@ form.addEventListener("submit", async (evt) => {
const resp = await fetch("api/answer", { method, body, headers: { "Content-Type": "application/json" } });
const res = await resp.json();
- if (!res.success) alert("An error occurred");
- else init = false;
+ if (!res.success) {
+ alert("An error occurred");
+ } else {
+ init = false;
+ alert("Okidoki, danke!");
+ }
});
saveBtn.addEventListener("click", (e) => {
diff --git a/profile/public/style.css b/profile/public/style.css
index becb428..bb7af3c 100644
--- a/profile/public/style.css
+++ b/profile/public/style.css
@@ -139,7 +139,6 @@ img {
z-index: 10;
position: absolute;
display: none;
- max-height: 600px;
max-width: 600px;
left: 50%;
top: 50%;
diff --git a/profile/public/user.js b/profile/public/user.js
index 963904c..936118e 100644
--- a/profile/public/user.js
+++ b/profile/public/user.js
@@ -164,6 +164,7 @@ function addChar(char) {
});
const inp = document.createElement("input");
const btn = document.createElement("button");
+ btn.classList.add("pure-button", "pure-button-primary");
btn.textContent = "Senden";
if (char.hasOwnProperty("txt")) {
@@ -181,6 +182,7 @@ function addChar(char) {
headers: { "Content-Type": "application/json" },
body,
});
+ alert("Okidoki, danke!");
});
const div = document.createElement("div");
div.style.display = "flex";