Update deps; WIP on comments

This commit is contained in:
2025-01-23 22:11:12 -05:00
parent 88841fd3f8
commit dc30716b83
15 changed files with 1454 additions and 1110 deletions
+68 -66
View File
@@ -1,102 +1,104 @@
/// View rendering context for myWebLog
/// <summary>View rendering context for myWebLog</summary>
[<AutoOpen>]
module MyWebLog.ViewContext
open Microsoft.AspNetCore.Antiforgery
open MyWebLog.ViewModels
/// The rendering context for this application
/// <summary>The rendering context for this application</summary>
[<NoComparison; NoEquality>]
type AppViewContext = {
/// The web log for this request
/// <summary>The web log for this request</summary>
WebLog: WebLog
/// The ID of the current user
/// <summary>The ID of the current user</summary>
UserId: WebLogUserId option
/// The title of the page being rendered
/// <summary>The title of the page being rendered</summary>
PageTitle: string
/// The subtitle for the page
/// <summary>The subtitle for the page</summary>
Subtitle: string option
/// The anti-Cross Site Request Forgery (CSRF) token set to use when rendering a form
/// <summary>The anti-Cross Site Request Forgery (CSRF) token set to use when rendering a form</summary>
Csrf: AntiforgeryTokenSet option
/// The page list for the web log
/// <summary>The page list for the web log</summary>
PageList: DisplayPage array
/// Categories and post counts for the web log
/// <summary>Categories and post counts for the web log</summary>
Categories: DisplayCategory array
/// Tag mappings
/// <summary>Tag mappings</summary>
TagMappings: TagMap array
/// The URL of the page being rendered
/// <summary>The URL of the page being rendered</summary>
CurrentPage: string
/// User messages
/// <summary>User messages</summary>
Messages: UserMessage array
/// The generator string for the rendered page
/// <summary>The generator string for the rendered page</summary>
Generator: string
/// The payload for this page (see other properties that wrap this one)
/// <summary>The payload for this page (see other properties that wrap this one)</summary>
Payload: obj
/// The content of a page (wrapped when rendering the layout)
/// <summary>The content of a page (wrapped when rendering the layout)</summary>
Content: string
/// A string to load the minified htmx script
/// <summary>A string to load the minified htmx script</summary>
HtmxScript: string
/// Whether the current user is an author
/// <summary>Whether the current user is an author</summary>
IsAuthor: bool
/// Whether the current user is an editor (implies author)
/// <summary>Whether the current user is an editor (implies author)</summary>
IsEditor: bool
/// Whether the current user is a web log administrator (implies author and editor)
/// <summary>Whether the current user is a web log administrator (implies author and editor)</summary>
IsWebLogAdmin: bool
/// Whether the current user is an installation administrator (implies all web log rights)
/// <summary>Whether the current user is an installation administrator (implies all web log rights)</summary>
IsAdministrator: bool
/// Whether the current page is the home page of the web log
/// <summary>Whether the current page is the home page of the web log</summary>
IsHome: bool
/// Whether the current page is a category archive page
/// <summary>Whether the current page is a category archive page</summary>
IsCategory: bool
/// Whether the current page is a category archive home page
/// <summary>Whether the current page is a category archive home page</summary>
IsCategoryHome: bool
/// Whether the current page is a tag archive page
/// <summary>Whether the current page is a tag archive page</summary>
IsTag: bool
/// Whether the current page is a tag archive home page
/// <summary>Whether the current page is a tag archive home page</summary>
IsTagHome: bool
/// Whether the current page is a single post
/// <summary>Whether the current page is a single post</summary>
IsPost: bool
/// Whether the current page is a static page
/// <summary>Whether the current page is a static page</summary>
IsPage: bool
/// The slug for a category or tag
Slug: string option }
with
/// Whether there is a user logged on
/// <summary>The slug for a category or tag</summary>
Slug: string option
} with
/// <summary>Whether there is a user logged on</summary>
member this.IsLoggedOn = Option.isSome this.UserId
/// <summary>The payload for this page as a <c>DisplayPage</c></summary>
member this.Page =
this.Payload :?> DisplayPage
/// <summary>The payload for this page as a <c>PostDisplay</c></summary>
member this.Posts =
this.Payload :?> PostDisplay
/// An empty view context
/// <summary>An empty view context</summary>
static member Empty =
{ WebLog = WebLog.Empty
UserId = None
@@ -105,21 +107,21 @@ with
Csrf = None
PageList = [||]
Categories = [||]
TagMappings = [||]
TagMappings = [||]
CurrentPage = ""
Messages = [||]
Generator = ""
Payload = obj ()
Content = ""
Payload = obj ()
Content = ""
HtmxScript = ""
IsAuthor = false
IsEditor = false
IsWebLogAdmin = false
IsAdministrator = false
IsHome = false
IsCategory = false
IsCategory = false
IsCategoryHome = false
IsTag = false
IsTag = false
IsTagHome = false
IsPost = false
IsPage = false