update: service, handlers, and db separation
This commit is contained in:
14
templates/partials/todo.templ
Normal file
14
templates/partials/todo.templ
Normal file
@@ -0,0 +1,14 @@
|
||||
package partials
|
||||
|
||||
import "michaelthomson.dev/mthomson/go-todos-app/db"
|
||||
|
||||
func todoId(todo db.Todo) string {
|
||||
return "todo-" + todo.Id.String()
|
||||
}
|
||||
|
||||
templ Todo(todo db.Todo) {
|
||||
<div id={ todoId(todo) }>
|
||||
{ todo.Id.String() }: { todo.Name }
|
||||
<button hx-delete={ "/todos/" + todo.Id.String() } hx-target={ "#" + todoId(todo) } hx-swap="delete">Delete</button>
|
||||
</div>
|
||||
}
|
||||
Reference in New Issue
Block a user