From 0c8813addfcea8422e1cd6320862528124ee1379 Mon Sep 17 00:00:00 2001 From: xoy Date: Sat, 28 Jan 2023 21:01:15 +0100 Subject: [PATCH] =?UTF-8?q?an=20der=20funktionalit=C3=A4t=20der=20events?= =?UTF-8?q?=20gearbeitet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.yml | 4 ++-- func.go | 9 +++++++-- web/pages/admin/dashboard.html | 9 +++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/config/database.yml b/config/database.yml index 79e698c..69e8c8f 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,5 +1,5 @@ -username: root -password: +username: admin +password: password address: localhost port: 3306 database: ctdo \ No newline at end of file diff --git a/func.go b/func.go index cbb8d9c..2c5b254 100644 --- a/func.go +++ b/func.go @@ -34,6 +34,7 @@ func handler() { if keys != nil { for _, key := range keys { httpHandleFunc("admin/"+key, "./web/pages/admin/dashboard.html", "text/html") + httpHandleFuncWithPOST("admin/"+key+"/addEvent", "./web/pages/admin/dashboard.html", "text/html") } } @@ -146,7 +147,8 @@ func htmlReplacer(input string, activePage string) string { events := getEvents() if len(events) == 0 { - output = strings.ReplaceAll(output, "!EVENTS", htmlElement("h4", "Keine Events in der nächsten Zeit!", "")) + output = strings.ReplaceAll(output, "!EVENTS", htmlElement("h4", "Keine Events in der nächsten Zeit.", "")) + output = strings.ReplaceAll(output, "!NEXTEVENTS", htmlElement("h4", "Keine Events in der nächsten Zeit.", "")) } else { tempA, tempB := "", "" for i, Event := range events { @@ -159,11 +161,14 @@ func htmlReplacer(input string, activePage string) string { tempA += htmlElement("p", Event.date, "") tempB += htmlElement("div", tempA, "class=\"event\"") } - output = strings.ReplaceAll(output, "!EVENTS", tempB) + output = strings.ReplaceAll(output, "!EVENTS", htmlElement("div", tempB, "class=\"eventList\"")) + output = strings.ReplaceAll(output, "!NEXTEVENTS", htmlElement("div", string(tempB[0]+tempB[1]+tempB[2]+tempB[3]), "class=\"eventList\"")) } output = strings.ReplaceAll(output, "!NEWBANNER", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/")) + output = strings.ReplaceAll(output, "!ADMINKEY", activePage) + return output } diff --git a/web/pages/admin/dashboard.html b/web/pages/admin/dashboard.html index c6d50e1..300f355 100644 --- a/web/pages/admin/dashboard.html +++ b/web/pages/admin/dashboard.html @@ -15,6 +15,15 @@
!RAUMSTATUS + !EVENTS + +
+
+
+
+
+ +