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 {
log.Print("MainHandler called")
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 {
http.Error(w, err.Error(), http.StatusInternalServerError)
return

View file

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

View file

@ -38,16 +38,19 @@
<div class="tile is-ancestor">
<div class="tile is-parent">
<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="hero-background">
<img src="/images/images/banner.jpg" alt="Dungeons-and-Dragons-Banner">
</div>
<p class="title">
<div class="hero-content is-overlay">
<p class="title is-size-5-mobile is-size-1-desktop"
style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
Dungeons and Dragons Monster Generator
</p>
</div>
</div>
</div>
</section>
</div>
</div>

View file

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