frontend: remove error causing hx-boost attribute on form and make title responsive and centered

This commit is contained in:
Patryk Hegenberg 2023-12-06 13:09:43 +01:00
parent 309ade3e72
commit faf7c2f782
4 changed files with 9 additions and 7 deletions

View file

@ -12,7 +12,7 @@ import (
func MainHandler(content embed.FS, monsters *[]model.Monster) http.HandlerFunc { func MainHandler(content embed.FS, monsters *[]model.Monster) http.HandlerFunc {
log.Print("MainHandler called") log.Print("MainHandler called")
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
tmpl, err := template.ParseFS(content, "templates/main.html", "templates/monsterForm.html", "templates/monster.html", "templates/monsterTable.html") tmpl, err := template.ParseFS(content, "templates/main.html", "templates/monsterForm.html", "templates/monster.html", "templates/monsterTable.html", "templates/base.html")
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return

View file

@ -46,7 +46,6 @@ func SubmitHandler(content embed.FS, chars *[]model.Character, Monsters *[]model
return return
} }
log.Printf("Monster hinzugefügt. Anzahl der Monster jetzt: %d\n", len(*Monsters))
// JSON-Daten in die Datei schreiben // JSON-Daten in die Datei schreiben
err = model.WriteToFile(filename, charJSON) err = model.WriteToFile(filename, charJSON)
if err != nil { if err != nil {

View file

@ -38,14 +38,17 @@
<div class="tile is-ancestor"> <div class="tile is-ancestor">
<div class="tile is-parent"> <div class="tile is-parent">
<section class="tile is-child hero box is-widescreen"> <section class="tile is-child hero box is-widescreen">
<div class="hero-body"> <div class="hero-body is-flex is-justify-content-center is-align-items-center">
<div class="container has-text-centered"> <div class="container has-text-centered">
<div class="hero-background"> <div class="hero-background">
<img src="/images/images/banner.jpg" alt="Dungeons-and-Dragons-Banner"> <img src="/images/images/banner.jpg" alt="Dungeons-and-Dragons-Banner">
</div> </div>
<p class="title"> <div class="hero-content is-overlay">
Dungeons and Dragons Monster Generator <p class="title is-size-5-mobile is-size-1-desktop"
</p> style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
Dungeons and Dragons Monster Generator
</p>
</div>
</div> </div>
</div> </div>
</section> </section>

View file

@ -6,7 +6,7 @@
<p class="title is-4">Monster Form</p> <p class="title is-4">Monster Form</p>
</div> </div>
<div class="content"> <div class="content">
<form hx-boost="true" action="/submit" method="post" class=""> <form action="/submit" method="post" class="">
<div class="field"> <div class="field">
<td><label for="filename">Filename:</label></td> <td><label for="filename">Filename:</label></td>
<div class="control"><input type="text" name="filename" required placeholder="Dateiname" <div class="control"><input type="text" name="filename" required placeholder="Dateiname"