Turbo/Frames/Controllers
// app/controllers/post_controller/postcontroller.go
package postcontroller
import "golazy.dev/lazyturbo"
func (c *PostsController) Comments(post *Post) error {
c.Set("comments", c.posts.Comments(post.ID))
return c.RenderTurboFrame("comments", lazyturbo.Loading("lazy"))
}
{{/* app/views/posts/_comments_frame.html.tpl */}}
<ol>
{{ range .comments }}
<li>{{.Body}}</li>
{{ else }}
<li>No comments yet.</li>
{{ end }}
</ol>