an der funktionalität der events gearbeitet

This commit is contained in:
xoy 2023-01-28 21:01:15 +01:00
parent 1e4c367836
commit c3d246c81c
3 changed files with 18 additions and 4 deletions

View File

@ -1,5 +1,5 @@
username: root
password:
username: admin
password: password
address: localhost
port: 3306
database: ctdo

View File

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

View File

@ -15,6 +15,15 @@
</header>
<main>
!RAUMSTATUS
!EVENTS
<form action="admin/!ADMINKEY/addEvent" method="post">
<input type="text" name="title" placeholder="Titel"><br>
<input type="text" name="description" placeholder="Beschreibung"><br>
<label for="media">Bilder:</label><input type="file" name="media" id="media" multiple><br>
<label for="date">Datum:</label><input type="date" name="date" id="date"><br>
<input type="submit" value="Event Erstellen">
</form>
</main>
<footer>
!FOOTERNAV