htmx
This commit is contained in:
parent
83db61c1e2
commit
ce9c34e2df
4
main.go
4
main.go
@ -45,7 +45,7 @@ func main() {
|
|||||||
r.SetFuncMap(template.FuncMap{
|
r.SetFuncMap(template.FuncMap{
|
||||||
"upper": strings.ToUpper,
|
"upper": strings.ToUpper,
|
||||||
})
|
})
|
||||||
r.LoadHTMLFiles("templates/index.tmpl")
|
r.LoadHTMLFiles("templates/index.tmpl", "templates/phrase.tmpl")
|
||||||
r.StaticFile("/favicon.ico", "./assets/favicon.ico")
|
r.StaticFile("/favicon.ico", "./assets/favicon.ico")
|
||||||
r.StaticFile("/main.js", "./assets/main.js")
|
r.StaticFile("/main.js", "./assets/main.js")
|
||||||
r.StaticFile("/htmx.js", "./assets/htmx@1.9.10.min.js")
|
r.StaticFile("/htmx.js", "./assets/htmx@1.9.10.min.js")
|
||||||
@ -96,7 +96,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
p.Source = s
|
p.Source = s
|
||||||
p.ID = id.Int64()
|
p.ID = id.Int64()
|
||||||
c.JSON(http.StatusOK, p)
|
c.HTML(http.StatusOK, "phrase.tmpl", p)
|
||||||
})
|
})
|
||||||
|
|
||||||
r.Run() // 8080
|
r.Run() // 8080
|
||||||
|
@ -40,7 +40,23 @@
|
|||||||
<button id="edit">edit</button>
|
<button id="edit">edit</button>
|
||||||
<button id="move">move</button>
|
<button id="move">move</button>
|
||||||
</span>
|
</span>
|
||||||
<span class="linetext"></span>
|
<span hx-swap="outerHTML" hx-get="/line" hx-trigger="load" class="linetext"></span>
|
||||||
|
</div>
|
||||||
|
<div class="linecontainer">
|
||||||
|
<span class="linecontrols">
|
||||||
|
<button id="pin">pin</button>
|
||||||
|
<button id="edit">edit</button>
|
||||||
|
<button id="move">move</button>
|
||||||
|
</span>
|
||||||
|
<span hx-swap="outerHTML" hx-get="/line" hx-trigger="load" class="linetext"></span>
|
||||||
|
</div>
|
||||||
|
<div class="linecontainer">
|
||||||
|
<span class="linecontrols">
|
||||||
|
<button id="pin">pin</button>
|
||||||
|
<button id="edit">edit</button>
|
||||||
|
<button id="move">move</button>
|
||||||
|
</span>
|
||||||
|
<span hx-swap="outerHTML" hx-get="/line" hx-trigger="load" class="linetext"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/htmx.js"></script>
|
<script src="/htmx.js"></script>
|
||||||
|
1
templates/phrase.tmpl
Normal file
1
templates/phrase.tmpl
Normal file
@ -0,0 +1 @@
|
|||||||
|
<span hx-get="/line" data-source="{{.Source.Name}}">{{.Text}}</span>
|
Loading…
x
Reference in New Issue
Block a user