WIP on adding htmax option (#59)

This commit is contained in:
2026-07-05 17:54:36 -04:00
parent 7c588662d2
commit 9d2277ab32
10 changed files with 81 additions and 15 deletions
+2 -2
View File
@@ -341,7 +341,7 @@ type WebLog = {
Rss: RssOptions
/// <summary>Whether to automatically load htmx</summary>
AutoHtmx: bool
AutoHtmx: AutoHtmxType
/// <summary>Where uploads are placed</summary>
Uploads: UploadDestination
@@ -365,7 +365,7 @@ type WebLog = {
UrlBase = ""
TimeZone = ""
Rss = RssOptions.Empty
AutoHtmx = false
AutoHtmx = NoAutoHtmx
Uploads = Database
RedirectRules = []
AutoOpenGraph = true }
+32
View File
@@ -105,6 +105,38 @@ type AccessLevel =
AccessLevel.Weights[needed] <= AccessLevel.Weights[this]
/// <summary>How the htmx library will be auto-injected in a web log's theme pages</summary>
[<Struct>]
type AutoHtmxType =
/// <summary>Do not auto-inject htmx into the web log's theme pages</summary>
| NoAutoHtmx
/// <summary>Inject the standard htmx library into the web log's theme pages</summary>
| AutoHtmx
/// <summary>Inject the htmax library bundle into the web log's theme pages</summary>
| AutoHtmax
/// <summary>Parse an auto-htmx type from its string representation</summary>
/// <param name="typ">The string representation to be parsed</param>
/// <returns>The <c>AutoHtmxType</c> instance parsed from the string</returns>
/// <exception cref="InvalidArgumentException">If the string is not valid</exception>
static member Parse typ =
match typ with
| "No" -> NoAutoHtmx
| "Yes" -> AutoHtmx
| "Max" -> AutoHtmax
| _ -> invalidArg (nameof typ) $"{typ} is not a valid auto-htmx type"
/// <inheritdoc />
override this.ToString() =
match this with
| NoAutoHtmx -> "No"
| AutoHtmx -> "Yes"
| AutoHtmax -> "Max"
/// <summary>An identifier for a category</summary>
[<Struct>]
type CategoryId =
+3 -3
View File
@@ -1379,7 +1379,7 @@ type SettingsModel = {
ThemeId: string
/// <summary>Whether to automatically load htmx</summary>
AutoHtmx: bool
AutoHtmx: string
/// <summary>The default location for uploads</summary>
Uploads: string
@@ -1399,7 +1399,7 @@ type SettingsModel = {
PostsPerPage = webLog.PostsPerPage
TimeZone = webLog.TimeZone
ThemeId = string webLog.ThemeId
AutoHtmx = webLog.AutoHtmx
AutoHtmx = string webLog.AutoHtmx
Uploads = string webLog.Uploads
AutoOpenGraph = webLog.AutoOpenGraph }
@@ -1415,7 +1415,7 @@ type SettingsModel = {
PostsPerPage = this.PostsPerPage
TimeZone = this.TimeZone
ThemeId = ThemeId this.ThemeId
AutoHtmx = this.AutoHtmx
AutoHtmx = AutoHtmxType.Parse this.AutoHtmx
Uploads = UploadDestination.Parse this.Uploads
AutoOpenGraph = this.AutoOpenGraph }