Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed render example #20

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/render/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func main() {

htmx.UseTemplateCache = false

http.HandleFunc("/", app.Home)
http.HandleFunc("/child", app.Child)
mux.HandleFunc("/", app.Home)
mux.HandleFunc("/child", app.Child)

err := http.ListenAndServe(":3210", mux)
log.Fatal(err)
Expand Down
10 changes: 7 additions & 3 deletions examples/render/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{{ $self := . }}
<div hx-boost="true" hx-target="#content" _="on click take .bg-blue-500 from .block for the event's target">
<div hx-boost="true" hx-target="#content" >
{{ range $target := .Data.MenuItems }}
<a href="{{ $target.Link }}" class="cursor-pointer block rounded rounded-md p-4 my-2 {{ if eq $self.URL.Path $target.Link }} bg-blue-500 {{ end }}">{{ $target.Name }}</a>
<a
href="{{ $target.Link }}"
class="cursor-pointer block rounded rounded-md p-4 my-2 {{ if eq $self.URL.Path $target.Link }} bg-blue-500 {{ end }}"
_="on click take .bg-blue-500 from .block for the event's target"
>{{ $target.Name }}</a>
{{ end }}
</div>
</div>
Loading