update: service, handlers, and db separation
This commit is contained in:
20
templates/pages/home.templ
Normal file
20
templates/pages/home.templ
Normal file
@@ -0,0 +1,20 @@
|
||||
package pages
|
||||
|
||||
import "michaelthomson.dev/mthomson/go-todos-app/templates/shared"
|
||||
import "michaelthomson.dev/mthomson/go-todos-app/db"
|
||||
import "michaelthomson.dev/mthomson/go-todos-app/templates/partials"
|
||||
|
||||
templ Home(todos []db.Todo) {
|
||||
@shared.Page("Todos") {
|
||||
<div class="text-xl">Todos</div>
|
||||
<form hx-post="/todos" hx-target="#todos" hx-swap="beforeend">
|
||||
<input name="name" type="text" />
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
<div id="todos">
|
||||
for _, todo := range todos {
|
||||
@partials.Todo(todo)
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user