an der funktionalität der events gearbeitet

This commit is contained in:
xoy 2023-01-29 18:51:29 +01:00
parent 3646c0e50d
commit 09606f7a00
6 changed files with 94 additions and 8 deletions

16
html.go
View File

@ -77,13 +77,17 @@ func htmlReplacer(input string, activePage string) string {
break break
} }
tempA = htmlElement("h2", htmlClean(Event.title), "") tempA = htmlElement("h2", htmlClean(Event.title), "title")
tempA += htmlElement("p", htmlClean(Event.description), "") tempA += htmlElement("p", htmlClean(Event.date), "date")
tempA += htmlElement("p", htmlClean(Event.date), "") tempA += htmlElement("p", htmlClean(Event.description), "desc")
tempB += htmlElement("div", tempA, "class=\"event\"") if i > 0 {
tempB += "!SPLIT"
} }
output = strings.ReplaceAll(output, "!EVENTS", htmlElement("div", tempB, "class=\"eventList\"")) tempB += htmlLinkElement(htmlElement("div", tempA, ""), "event/"+string(Event.id), false, "class=\"event\"")
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/")) output = strings.ReplaceAll(output, "!NEWBANNER", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/"))

17
main.go
View File

@ -27,13 +27,13 @@ func main() {
func handler() { func handler() {
//pages //pages
logger("----------------HANDLE Pages----------------") logger("----------------HANDLE PAGES----------------")
httpHandleFunc("", "./web/pages/home.html", "text/html") httpHandleFunc("", "./web/pages/home.html", "text/html")
handleFilesInFolder("", "./web/pages/", true) handleFilesInFolder("", "./web/pages/", true)
logger("----------------HANDLE END----------------") logger("----------------HANDLE END----------------")
logger("----------------HANDLE ADMIN LOGIN----------------")
//admin pages //admin pages
logger("----------------HANDLE ADMIN LOGIN----------------")
keys := getAdminKeys() keys := getAdminKeys()
if len(keys) > 0 { if len(keys) > 0 {
for _, key := range keys { for _, key := range keys {
@ -43,6 +43,8 @@ func handler() {
} }
logger("----------------HANDLE END----------------") logger("----------------HANDLE END----------------")
//events
//styles //styles
logger("----------------HANDLE STYLES----------------") logger("----------------HANDLE STYLES----------------")
handleFilesInFolder("style/", "./web/styles/", false) handleFilesInFolder("style/", "./web/styles/", false)
@ -52,6 +54,17 @@ func handler() {
handleImages() 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() { func handleImages() {
logger("----------------HANDLE IMAGES----------------") logger("----------------HANDLE IMAGES----------------")
handleFilesInFolder("image/", "./web/images/", false) handleFilesInFolder("image/", "./web/images/", false)

View File

@ -7,6 +7,7 @@
<title>ctdo - admin</title> <title>ctdo - admin</title>
<link rel="stylesheet" href="/style/main.css"> <link rel="stylesheet" href="/style/main.css">
<link rel="stylesheet" href="/style/dashboard.css"> <link rel="stylesheet" href="/style/dashboard.css">
<link rel="stylesheet" href="/style/events.css">
</head> </head>
<body> <body>
<header> <header>

27
web/pages/event.html Normal file
View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ctdo - events</title>
<link rel="stylesheet" href="/style/main.css">
<link rel="stylesheet" href="/style/event.css">
</head>
<body>
!NEWBANNER
<header>
<img src="/image/logo_ctdo.svg" alt="ctdo logo" style="width:100%;">
!NAV
</header>
<main>
<h1 class="title">!EVENTTITLE</h1>
<p class="date">!EVENTDATE</p>
<p class="desc">!EVENTDESC</p>
<!--<p class="content">!EVENTCONTENT</p>-->
</main>
<footer>
!FOOTERNAV
</footer>
</body>
</html>

View File

@ -7,6 +7,7 @@
<title>ctdo - home</title> <title>ctdo - home</title>
<link rel="stylesheet" href="/style/main.css"> <link rel="stylesheet" href="/style/main.css">
<link rel="stylesheet" href="/style/home.css"> <link rel="stylesheet" href="/style/home.css">
<link rel="stylesheet" href="/style/events.css">
</head> </head>
<body> <body>
!NEWBANNER !NEWBANNER

View File

@ -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;
}