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 + +
+
+
+
+
+ +