Hey @Cies, thanks for the request. We have prototyped htmx support some time ago and will publish an update soon 🙂
c
Cies
10/16/2024, 7:22 AM
@e5l we'll wait it out then 🙂 thanks! (not for me though, we barely use HTML-fragments in our codebase)
r
Reuben Firmin
10/16/2024, 10:48 AM
Here's a couple snippets from my codebase, which uses htmx/kotlinx.html:
Reuben Firmin
10/16/2024, 10:48 AM
Copy code
@GET("/subscribe_banner")
fun getSubscribeBanner(ctx: Context) = ctx.fragment(DashboardPage.subscribeTarget) {
subscribeBanner(billingApi)
}
I use server side targeting, which gives me nice type safety
Reuben Firmin
10/16/2024, 10:49 AM
or, for a whole page:
Copy code
@GET()
fun get(ctx: Context) = ctx.page(dashboardTemplate, "My App", listOf {
...
val currentSubscription = paymentDAO.getCurrentSubscription(userWithSub)
renderDashboard(currentSubscription, this@DashboardApi)
})
The templates have a number of slots, which the list renders into.
The string is the title to use on the page.
Also, all pages use hx-boost, so even this is using htmx.
Reuben Firmin
10/16/2024, 10:50 AM
And then the actual render functions are like this: