!EVENTTITLE
+!EVENTDATE
+!EVENTDESC
+ +diff --git a/html.go b/html.go index c588804..bc83557 100644 --- a/html.go +++ b/html.go @@ -77,13 +77,17 @@ func htmlReplacer(input string, activePage string) string { break } - tempA = htmlElement("h2", htmlClean(Event.title), "") - tempA += htmlElement("p", htmlClean(Event.description), "") - tempA += htmlElement("p", htmlClean(Event.date), "") - tempB += htmlElement("div", tempA, "class=\"event\"") + tempA = htmlElement("h2", htmlClean(Event.title), "title") + tempA += htmlElement("p", htmlClean(Event.date), "date") + tempA += htmlElement("p", htmlClean(Event.description), "desc") + if i > 0 { + tempB += "!SPLIT" + } + tempB += htmlLinkElement(htmlElement("div", tempA, ""), "event/"+string(Event.id), false, "class=\"event\"") } - 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, "!EVENTS", htmlElement("div", strings.ReplaceAll(tempB, "!SPLIT", ""), "class=\"eventList\"")) + tempC := strings.Split(tempB, "!SPLIT") + output = strings.ReplaceAll(output, "!NEXTEVENTS", htmlElement("div", tempC[0]+tempC[1]+tempC[2]+tempC[3], "class=\"eventList\"")) } output = strings.ReplaceAll(output, "!NEWBANNER", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/")) diff --git a/main.go b/main.go index d426157..ead1438 100644 --- a/main.go +++ b/main.go @@ -27,13 +27,13 @@ func main() { func handler() { //pages - logger("----------------HANDLE Pages----------------") + logger("----------------HANDLE PAGES----------------") httpHandleFunc("", "./web/pages/home.html", "text/html") handleFilesInFolder("", "./web/pages/", true) logger("----------------HANDLE END----------------") - logger("----------------HANDLE ADMIN LOGIN----------------") //admin pages + logger("----------------HANDLE ADMIN LOGIN----------------") keys := getAdminKeys() if len(keys) > 0 { for _, key := range keys { @@ -43,6 +43,8 @@ func handler() { } logger("----------------HANDLE END----------------") + //events + //styles logger("----------------HANDLE STYLES----------------") handleFilesInFolder("style/", "./web/styles/", false) @@ -52,6 +54,17 @@ func handler() { handleImages() } +func handleEvents() { + if getEventCount() > 0 { + logger("----------------HANDLE EVENTS----------------") + events := getEvents() + for _, e := range events { + httpHandleFunc("event/"+string(e.id), "./web/pages/event.html", "text/html") + } + logger("----------------HANDLE END----------------") + } +} + func handleImages() { logger("----------------HANDLE IMAGES----------------") handleFilesInFolder("image/", "./web/images/", false) diff --git a/web/pages/admin/dashboard.html b/web/pages/admin/dashboard.html index d681bf2..56b82b1 100644 --- a/web/pages/admin/dashboard.html +++ b/web/pages/admin/dashboard.html @@ -7,6 +7,7 @@
!EVENTDATE
+!EVENTDESC
+ +