diff --git a/Cargo.lock b/Cargo.lock index be45b77..2df2156 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -87,6 +87,7 @@ dependencies = [ "askama", "askama_axum", "axum", + "axum-htmx", "cargo-watch", "listenfd", "notify 6.1.1", @@ -398,6 +399,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "axum-htmx" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36cdb6062317f732ed3acf4e9c28c3824092e226726616f46ebdd8cd32c82a41" +dependencies = [ + "async-trait", + "axum-core", + "futures", + "http", + "tokio", + "tower", +] + [[package]] name = "backtrace" version = "0.3.73" @@ -1470,6 +1485,20 @@ dependencies = [ "new_debug_unreachable", ] +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.30" @@ -1477,6 +1506,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", + "futures-sink", ] [[package]] diff --git a/crates/app/Cargo.toml b/crates/app/Cargo.toml index e095c3a..175b803 100644 --- a/crates/app/Cargo.toml +++ b/crates/app/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" askama = "0.12.1" askama_axum = "0.4.0" axum = "0.7.5" +axum-htmx = { version = "0.6", features = ["auto-vary"] } listenfd = "1.0.1" notify = "6.1.1" serde = { version = "1.0.204", features = ["derive"] } diff --git a/crates/app/src/components/base.html b/crates/app/src/components/base.html index 651fb67..c128735 100644 --- a/crates/app/src/components/base.html +++ b/crates/app/src/components/base.html @@ -1,3 +1,7 @@ +{% if hx_request %} +