Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 86defea3c1 | |||
| 9a9f159cab | |||
| 9fcba06e75 |
@@ -63,6 +63,8 @@ Some attributes have known values, such as `hx-trigger` and `hx-swap`; for these
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you want to load htmx from unpkg, `Htmx.Script.minified` or `Htmx.Script.unminified` can be used to load the script in your HTML trees.
|
||||||
|
|
||||||
## Feedback / Help
|
## Feedback / Help
|
||||||
|
|
||||||
The author hangs out in the #htmx-general channel of the [htmx Discord server](https://htmx.org/discord) and the #web channel of the [F# Software Foundation's Slack server](https://fsharp.org/guides/slack/).
|
The author hangs out in the #htmx-general channel of the [htmx Discord server](https://htmx.org/discord) and the #web channel of the [F# Software Foundation's Slack server](https://fsharp.org/guides/slack/).
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>0.9.2</VersionPrefix>
|
<VersionPrefix>1.6.1</VersionPrefix>
|
||||||
<PackageReleaseNotes>Complete view engine modules; add READMEs</PackageReleaseNotes>
|
<PackageReleaseNotes>Initial production-ready release</PackageReleaseNotes>
|
||||||
<Authors>danieljsummers</Authors>
|
<Authors>danieljsummers</Authors>
|
||||||
<Company>Bit Badger Solutions</Company>
|
<Company>Bit Badger Solutions</Company>
|
||||||
<PackageProjectUrl>https://github.com/bit-badger/Giraffe.Htmx</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/bit-badger/Giraffe.Htmx</PackageProjectUrl>
|
||||||
|
|||||||
@@ -250,6 +250,17 @@ module HandlerTests =
|
|||||||
Assert.Equal ("false", dic.["HX-Refresh"].[0])
|
Assert.Equal ("false", dic.["HX-Refresh"].[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[<Fact>]
|
||||||
|
let ``withHxRetarget succeeds`` () =
|
||||||
|
let ctx = Substitute.For<HttpContext> ()
|
||||||
|
let dic = HeaderDictionary ()
|
||||||
|
ctx.Response.Headers.ReturnsForAnyArgs dic |> ignore
|
||||||
|
task {
|
||||||
|
let! _ = withHxRetarget "#somewhereElse" next ctx
|
||||||
|
Assert.True (dic.ContainsKey "HX-Retarget")
|
||||||
|
Assert.Equal ("#somewhereElse", dic.["HX-Retarget"].[0])
|
||||||
|
}
|
||||||
|
|
||||||
[<Fact>]
|
[<Fact>]
|
||||||
let ``withHxTrigger succeeds`` () =
|
let ``withHxTrigger succeeds`` () =
|
||||||
let ctx = Substitute.For<HttpContext> ()
|
let ctx = Substitute.For<HttpContext> ()
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ module Handlers =
|
|||||||
let withHxRefresh : bool -> HttpHandler =
|
let withHxRefresh : bool -> HttpHandler =
|
||||||
toLowerBool >> setHttpHeader "HX-Refresh"
|
toLowerBool >> setHttpHeader "HX-Refresh"
|
||||||
|
|
||||||
|
/// Allows you to override the `hx-target` attribute
|
||||||
|
let withHxRetarget : string -> HttpHandler =
|
||||||
|
setHttpHeader "HX-Retarget"
|
||||||
|
|
||||||
/// Allows you to trigger a single client side event
|
/// Allows you to trigger a single client side event
|
||||||
let withHxTrigger : string -> HttpHandler =
|
let withHxTrigger : string -> HttpHandler =
|
||||||
setHttpHeader "HX-Trigger"
|
setHttpHeader "HX-Trigger"
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
This package enables server-side support for [htmx](https://htmx.org) within [Giraffe](https://giraffe.wiki) and ASP.NET's `HttpContext`.
|
This package enables server-side support for [htmx](https://htmx.org) within [Giraffe](https://giraffe.wiki) and ASP.NET's `HttpContext`.
|
||||||
|
|
||||||
|
**htmx version: 1.6.1**
|
||||||
|
|
||||||
### Setup
|
### Setup
|
||||||
|
|
||||||
1. Install the package.
|
1. Install the package.
|
||||||
|
|||||||
@@ -212,3 +212,23 @@ module HtmxAttrs =
|
|||||||
let _hxVals = attr "hx-vals"
|
let _hxVals = attr "hx-vals"
|
||||||
/// Establishes a WebSocket or sends information to one
|
/// Establishes a WebSocket or sends information to one
|
||||||
let _hxWs = attr "hx-ws"
|
let _hxWs = attr "hx-ws"
|
||||||
|
|
||||||
|
|
||||||
|
/// Script tags to pull htmx into an web page
|
||||||
|
module Script =
|
||||||
|
|
||||||
|
/// Script tag to load the minified version from unpkg.com
|
||||||
|
let minified =
|
||||||
|
script [
|
||||||
|
_src "https://unpkg.com/htmx.org@1.6.1"
|
||||||
|
_integrity "sha384-tvG/2mnCFmGQzYC1Oh3qxQ7CkQ9kMzYjWZSNtrRZygHPDDqottzEJsqS4oUVodhW"
|
||||||
|
_crossorigin "anonymous"
|
||||||
|
] []
|
||||||
|
|
||||||
|
/// Script tag to load the unminified version from unpkg.com
|
||||||
|
let unminified =
|
||||||
|
script [
|
||||||
|
_src "https://unpkg.com/htmx.org@1.6.1/dist/htmx.js"
|
||||||
|
_integrity "sha384-7G9OE6gS4pBnBGH74HojjPQ8xOEGrdBeQc7JJOc58k6LG/YVfKXARd91w9715AYG"
|
||||||
|
_crossorigin "anonymous"
|
||||||
|
] []
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
This package enables [htmx](https://htmx.org) support within the [Giraffe](https://giraffe.wiki) view engine.
|
This package enables [htmx](https://htmx.org) support within the [Giraffe](https://giraffe.wiki) view engine.
|
||||||
|
|
||||||
|
**htmx version: 1.6.1**
|
||||||
|
|
||||||
### Setup
|
### Setup
|
||||||
|
|
||||||
1. Install the package.
|
1. Install the package.
|
||||||
@@ -25,6 +27,8 @@ Support modules include:
|
|||||||
- `HxTrigger`
|
- `HxTrigger`
|
||||||
- `HxVals`
|
- `HxVals`
|
||||||
|
|
||||||
|
There are two `XmlNode`s that will load the htmx script from unpkg; `Htmx.Script.minified` loads the minified version, and `Htmx.Script.unminified` loads the unminified version (useful for debugging).
|
||||||
|
|
||||||
### Learn
|
### Learn
|
||||||
|
|
||||||
htmx's attributes and these attribute functions map one-to-one. The lone exception is `_hxBoost`, which implies `true`; use `_hxNoBoost` to set it to `false`. The support modules contain named properties for known values (as illustrated with `HxTrigger.Load` above). A few of the modules are more than collections of names, though:
|
htmx's attributes and these attribute functions map one-to-one. The lone exception is `_hxBoost`, which implies `true`; use `_hxNoBoost` to set it to `false`. The support modules contain named properties for known values (as illustrated with `HxTrigger.Load` above). A few of the modules are more than collections of names, though:
|
||||||
|
|||||||
Reference in New Issue
Block a user