From 09606f7a00f992cba2c6308f4c5194056ef3099e Mon Sep 17 00:00:00 2001 From: xoy Date: Sun, 29 Jan 2023 18:51:29 +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 --- html.go | 16 +++++++++----- main.go | 17 +++++++++++++-- web/pages/admin/dashboard.html | 1 + web/pages/event.html | 27 +++++++++++++++++++++++ web/pages/home.html | 1 + web/styles/events.css | 40 ++++++++++++++++++++++++++++++++++ 6 files changed, 94 insertions(+), 8 deletions(-) create mode 100644 web/pages/event.html 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 @@ ctdo - admin +
diff --git a/web/pages/event.html b/web/pages/event.html new file mode 100644 index 0000000..5404a10 --- /dev/null +++ b/web/pages/event.html @@ -0,0 +1,27 @@ + + + + + + + ctdo - events + + + + + !NEWBANNER +
+ ctdo logo + !NAV +
+
+

!EVENTTITLE

+

!EVENTDATE

+

!EVENTDESC

+ +
+
+ !FOOTERNAV +
+ + \ No newline at end of file diff --git a/web/pages/home.html b/web/pages/home.html index 501b6e3..d9cd5b2 100644 --- a/web/pages/home.html +++ b/web/pages/home.html @@ -7,6 +7,7 @@ ctdo - home + !NEWBANNER diff --git a/web/styles/events.css b/web/styles/events.css index e69de29..72ac9d7 100644 --- a/web/styles/events.css +++ b/web/styles/events.css @@ -0,0 +1,40 @@ +div.eventList { + display: flex; + justify-content: space-around; + width: 100%; + padding: 10px 0 10px 0; +} + +div.eventList a.event { + display: inline-block; + position: relative; +} + +div.eventList a.event:hover { + text-decoration: none; +} + +div.eventList a.event div.event { + display: inline-block; + position: relative; + max-width: 200px; + width: 100%; + height: 200px; + background-color: var(--nav-background-color); + border-radius: 10px; + transform: scale(1); + transition: transform .5s; +} + +div.eventList a.event div.event:hover { + transform: scale(.95); + transition: transform .5s; + text-decoration: underline; +} + +div.eventList a.event div.event p.date { + position: absolute; + right: 10px; + top: 10px; + text-decoration: none !important; +} \ No newline at end of file