From 753ff9b4d969c520cef509a1d77557167bd470fd Mon Sep 17 00:00:00 2001 From: Turtle <104490184+CodingTurtle2@users.noreply.github.com> Date: Mon, 22 Dec 2025 17:36:49 +0100 Subject: [PATCH] g2.5 --- prof/uebersicht.html | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/prof/uebersicht.html b/prof/uebersicht.html index c42897a..759c5c0 100644 --- a/prof/uebersicht.html +++ b/prof/uebersicht.html @@ -58,7 +58,7 @@ setUserData(couchDB); margin-bottom: 10px; position: relative; } -.edit_course .evaluation span { +.edit_course .evaluation input { display: inline-block; font-size: 20px !important; width: calc(100% - 80px); @@ -93,7 +93,7 @@ setUserData(couchDB);

- +

@@ -102,7 +102,10 @@ setUserData(couchDB); async function showEditCourse(name) { const data = await couchDB.get("course:" + name); - if (data.owner != userData.name) return; + if (data.owner != userData.name) { + console.error("User is not author"); + return; + } showOverlay("edit_course"); @@ -121,17 +124,26 @@ async function showEditCourse(name) { evaluations.innerHTML += createEvaluation(i); } } +function createNewEvaluation() { + const elm = getOverlay("edit_course"); + if (elm == null) return; + + const evaluations = elm.querySelector(".evaluations > div"); + evaluations.innerHTML += createEvaluation({ + "title": "", "type": "text" + }); +} function createEvaluation(question) { return ` -
- - ${question.title} +
+ + -
+
`; } async function saveEditCourse() { @@ -145,6 +157,20 @@ async function saveEditCourse() { data["title"] = title.value; data["description"] = description.value; + const evaluations = elm.querySelector(".evaluations > div"); + const questions = []; + for (var i of evaluations.getElementsByClassName("evaluation")) { + const inpE = i.querySelector("input"); + const selE = i.querySelector("select"); + if (inpE.value.length == 0) continue; + + questions.push({ + "title": inpE.value, + "type": selE.value + }); + } + data["questions"] = questions; + await couchDB.delete("course:" + oldID); await couchDB.set("course:" + title.value.toLowerCase(), data);