Conversation
osipxd
reviewed
Dec 18, 2024
ktor-server/ktor-server-plugins/ktor-server-htmx/common/src/io/ktor/server/htmx/HxRouting.kt
Show resolved
Hide resolved
ktor-server/ktor-server-plugins/ktor-server-htmx/common/src/io/ktor/server/htmx/HxRouting.kt
Outdated
Show resolved
Hide resolved
ktor-server/ktor-server-plugins/ktor-server-htmx/common/test/io/ktor/server/htmx/HtmxTest.kt
Show resolved
Hide resolved
ktor-server/ktor-server-plugins/ktor-server-htmx/common/src/io/ktor/server/htmx/HxAttributes.kt
Show resolved
Hide resolved
ktor-shared/ktor-htmx/common/src/io/ktor/htmx/HxAttributeKeys.kt
Outdated
Show resolved
Hide resolved
ktor-server/ktor-server-plugins/ktor-server-htmx/common/src/io/ktor/server/htmx/HxHeaders.kt
Outdated
Show resolved
Hide resolved
Comment on lines
+34
to
+39
| public val on: On | ||
| get() = On(map) | ||
|
|
||
| public fun on(event: String, script: String) { | ||
| map["hx-on:$event"] = script | ||
| } |
Member
There was a problem hiding this comment.
I don't remember what we decided here. Keep both options of syntax?
on["event] = "script"
on("event", "script")| public var pushUrl: String? by HxAttributeKeys.PushUrl | ||
| public var select: String? by HxAttributeKeys.Select | ||
| public var selectOob: String? by HxAttributeKeys.SelectOob | ||
| public var swap: String? by HxAttributeKeys.Swap |
Member
There was a problem hiding this comment.
We've had type-safe implementations for some of these fields. Will it be part of some future PR?
7c22c8a to
f555d1a
Compare
2c3b4d8 to
4a59355
Compare
466444a to
0767037
Compare
Mr3zee
approved these changes
Jan 28, 2025
0767037 to
ffafe9c
Compare
osipxd
approved these changes
Feb 10, 2025
| /** | ||
| * Sub-routes only apply to a specific HX-Target header. | ||
| */ | ||
| public fun target(expectedTrigger: String, body: Route.() -> Unit): Route = |
Member
There was a problem hiding this comment.
Suggested change
| public fun target(expectedTrigger: String, body: Route.() -> Unit): Route = | |
| public fun target(expectedTarget: String, body: Route.() -> Unit): Route = |
| } | ||
|
|
||
| /** | ||
| * Simplifies property access delegation for HxAttributes when setting attribute values from a string constant. |
Member
There was a problem hiding this comment.
Minor. Probably we could drop "HxAttributes" from the description?
84bbd03 to
6c7cca9
Compare
6c7cca9 to
0fba7be
Compare
0fba7be to
af2a880
Compare
af2a880 to
e2b593e
Compare
|
This is amazing. Nice work! 🎊
@bjhham Do you know if that is being tracked anywhere? It would be really useful with the HTMX plugin where we often respond with just a |
Member
Here it is: KTOR-8195 Partial HTML response |
osipxd
added a commit
that referenced
this pull request
Mar 19, 2025
osipxd
added a commit
that referenced
this pull request
Apr 7, 2025
e5l
pushed a commit
that referenced
this pull request
Apr 17, 2025
e5l
pushed a commit
that referenced
this pull request
Apr 17, 2025
e5l
pushed a commit
that referenced
this pull request
Apr 17, 2025
osipxd
pushed a commit
that referenced
this pull request
May 7, 2025
bjhham
added a commit
that referenced
this pull request
May 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Subsystem
Server, New plugin
Motivation
KTOR-7584 First-class HTMX support
Solution
This extends the routing and HTML builder DSL with some handy HTMX helpers. I tried to ere on the conservative side here by not including everything and adding an experimental flag so we can change things later after testing. We don't have the HTML fragments extension yet in the HTML DSL, but you can still do everything you need using valid HTML and attributes.