WIP on adding htmax option (#59)
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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 }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user