This commit is contained in:
Turtle committed 2025-12-22 19:26:09 +01:00
1 parent 753ff9b4d9
commit a595b33006
8 files changed
+100 -13

No files matched your search

+2 -2
View File
@@ -48,9 +48,9 @@ async function main() {
"more_data": "bla" "more_data": "bla"
}); });
const data = await couchDB.get("login"); const data = await couchDB.get("xample");
console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
//Gibt { "username": "bla", "password": "bla" } wieder //Gibt { "my_data": 1, "more_data": "bla" } wieder
} }
main(); main();
+24 -2
View File
@@ -55,10 +55,21 @@ async function createTemp() {
"type": "emoji" "type": "emoji"
} }
], ],
"result_history": [
{
"date": "2025-12-27",
"questions": [
["Gut, aber ...", 5],
["Schlecht", 1]
]
}
],
"result": [ "result": [
["YES", "YES", 5, 2], ["YES", "YES", 5, 2],
["YES", "YES", 1, 3] ["YES", "YES", 1, 3]
] ],
"start_date": "2025-12-23",
"expire_date": "2025-12-27"
}); });
await couchDB.set("course:weiche_ware", { await couchDB.set("course:weiche_ware", {
"title": "Weiche Ware", "title": "Weiche Ware",
@@ -74,9 +85,20 @@ async function createTemp() {
"type": "scala" "type": "scala"
} }
], ],
"result_history": [
{
"date": "2025-12-27",
"questions": [
["Gut, aber ...", 5],
["Schlecht", 1]
]
}
],
"result": [ "result": [
["Gut, aber ...", 5], ["Gut, aber ...", 5],
["Schlecht", 1] ["Schlecht", 1]
] ],
"start_date": "2025-12-23",
"expire_date": "2025-12-27"
}); });
} }
+7
View File
@@ -70,3 +70,10 @@ async function getUserData(couchDB) -> Map?;
//Setze den Nutzer, welcher unter der Variable userData verfügbar sein wird //Setze den Nutzer, welcher unter der Variable userData verfügbar sein wird
async function setUserData(couchDB) -> bool; async function setUserData(couchDB) -> bool;
``` ```
##Nützliche CSS-Klassen
- .profile = Runde Profilbox
- overlay = Overlay
- .header_bar_1 = Headerbar
- .header_bar_1_placeholder = Platzhalter für Headerbar
- .add_button = Runder "Hinzufügen"-Knopf
+4
View File
@@ -72,6 +72,8 @@ overlay {
left: 50%; left: 50%;
min-width: 250px; min-width: 250px;
min-height: 150px; min-height: 150px;
max-height: 95%;
max-width: 95%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
background: var(--accent_color_bg_o); background: var(--accent_color_bg_o);
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
@@ -117,6 +119,7 @@ overlay {
} }
.header_bar_1 > div:nth-child(1) { .header_bar_1 > div:nth-child(1) {
text-align: left; text-align: left;
width: 100%;
} }
.header_bar_1 > div:nth-child(2) { .header_bar_1 > div:nth-child(2) {
text-align: center; text-align: center;
@@ -124,6 +127,7 @@ overlay {
} }
.header_bar_1 > div:nth-child(3) { .header_bar_1 > div:nth-child(3) {
text-align: right; text-align: right;
width: 100%;
} }
.header_bar_1_placeholder { .header_bar_1_placeholder {
+2
View File
@@ -330,6 +330,7 @@ function getURLArgsMap() {
} }
return res; return res;
} }
async function getUserData(couchDB) { async function getUserData(couchDB) {
const username = getURLArgsMap()["user"]; const username = getURLArgsMap()["user"];
if (!username) return null; if (!username) return null;
@@ -341,6 +342,7 @@ async function getUserData(couchDB) {
"name": username "name": username
}; };
} }
var userData = null; var userData = null;
async function setUserData(couchDB) { async function setUserData(couchDB) {
const res = await getUserData(couchDB); const res = await getUserData(couchDB);
+2
View File
@@ -1,6 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title> <title>Login</title>
<link rel="stylesheet" href="./lib/basic.css"> <link rel="stylesheet" href="./lib/basic.css">
<script src="./auth.js"></script> <script src="./auth.js"></script>
+33
View File
@@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../lib/basic.css">
<script src="../auth.js"></script>
<script src="../lib/basic.js"></script>
<script>
const couchDB = new CouchDB();
setUserData(couchDB);
</script>
</head>
<body>
<style>
</style>
<div class="header_bar_1">
<div onclick="location.href = './uebersicht.html?user=' + userData.name;">
<div style="border-radius: 50%; border: 1px solid black; display: inline-block; text-align: center; width: 32px; font-size: 25px;">⇦</div>
&nbsp;&nbsp;Meine Kurse
</div>
<div><b>Auswertungen</b></div>
<div>
<button class="profile"></button>
</div>
</div>
<div class="header_bar_1_placeholder"></div>
<script>
</script>
</body>
</html>
+26 -9
View File
@@ -2,13 +2,13 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../lib/basic.css"> <link rel="stylesheet" href="../lib/basic.css">
<script src="../auth.js"></script> <script src="../auth.js"></script>
<script src="../lib/basic.js"></script> <script src="../lib/basic.js"></script>
<script> <script>
const couchDB = new CouchDB(); const couchDB = new CouchDB();
setUserData(couchDB); setUserData(couchDB);
</script> </script>
<title>Übersicht</title> <title>Übersicht</title>
</head> </head>
@@ -43,7 +43,7 @@ setUserData(couchDB);
.edit_course .evaluations { .edit_course .evaluations {
overflow-y: auto; overflow-y: auto;
text-align: center; text-align: center;
max-height: 400px; max-height: 300px;
border: 2px solid grey; border: 2px solid grey;
padding: 10px; padding: 10px;
border-radius: var(--border-radius); border-radius: var(--border-radius);
@@ -90,11 +90,15 @@ setUserData(couchDB);
<overlay id="edit_course"> <overlay id="edit_course">
<input placeholder="Kursname" style="width: calc(100% - 50px);"><br><br> <input placeholder="Kursname" style="width: calc(100% - 50px);"><br><br>
Beschreibung:
<textarea placeholder="Beschreibung"></textarea><br><br> <textarea placeholder="Beschreibung"></textarea><br><br>
Feedback-Fragen:
<div class="evaluations"> <div class="evaluations">
<div></div> <div></div>
<button class="add_button" onclick="createNewEvaluation()">+</button> <button class="add_button" onclick="createNewEvaluation()">+</button>
</div><br> </div><br>
Start-Termin: <input type="date" style="margin-bottom: 5px;"><br>
Abgabe-Termin: <input type="date"><br><br>
<button onclick="saveEditCourse()">Speichern</button> <button onclick="saveEditCourse()">Speichern</button>
</overlay> </overlay>
@@ -111,12 +115,14 @@ async function showEditCourse(name) {
const elm = getOverlay("edit_course"); const elm = getOverlay("edit_course");
const title = elm.getElementsByTagName("input")[0]; const inputs = elm.getElementsByTagName("input");
const description = elm.getElementsByTagName("textarea")[0]; const description = elm.getElementsByTagName("textarea")[0];
title.value = data.title; inputs[0].value = data.title;
title.setAttribute("oldID", name); inputs[0].setAttribute("oldID", name);
description.value = data.description; description.value = data.description;
inputs[1].value = data["start_date"] ?? "";
inputs[2].value = data["expire_date"] ?? "";
const evaluations = elm.querySelector(".evaluations > div"); const evaluations = elm.querySelector(".evaluations > div");
@@ -148,13 +154,13 @@ function createEvaluation(question) {
} }
async function saveEditCourse() { async function saveEditCourse() {
const elm = getOverlay("edit_course"); const elm = getOverlay("edit_course");
const title = elm.getElementsByTagName("input")[0]; const inputs = elm.getElementsByTagName("input");
const description = elm.getElementsByTagName("textarea")[0]; const description = elm.getElementsByTagName("textarea")[0];
const oldID = title.getAttribute("oldID"); const oldID = inputs[0].getAttribute("oldID");
const data = await couchDB.get("course:" + oldID); const data = await couchDB.get("course:" + oldID);
data["title"] = title.value; data["title"] = inputs[0].value;
data["description"] = description.value; data["description"] = description.value;
const evaluations = elm.querySelector(".evaluations > div"); const evaluations = elm.querySelector(".evaluations > div");
@@ -170,9 +176,20 @@ async function saveEditCourse() {
}); });
} }
data["questions"] = questions; data["questions"] = questions;
evaluations.remove();
if (inputs[1].value.length > 0) {
let dateObject = new Date(inputs[1].value);
let dateString = dateObject.toISOString().split('T')[0];
data["start_date"] = dateString;
} if (inputs[2].value.length > 0) {
let dateObject = new Date(inputs[2].value);
let dateString = dateObject.toISOString().split('T')[0];
data["expire_date"] = dateString;
}
await couchDB.delete("course:" + oldID); await couchDB.delete("course:" + oldID);
await couchDB.set("course:" + title.value.toLowerCase(), data); await couchDB.set("course:" + inputs[0].value.toLowerCase(), data);
hideOverlay("edit_course"); hideOverlay("edit_course");
} }