Add page edit

- Add nav link and user log-on link filter/tag
- Add page list support
- Add prior permalink index/search
- Remove v2 C# projects
This commit is contained in:
2022-04-18 18:06:17 -04:00
parent 8ce2d5a2ed
commit 48e6d3edfa
85 changed files with 593 additions and 4878 deletions

View File

@@ -2,7 +2,7 @@
open System
/// A category under which a post may be identfied
/// A category under which a post may be identified
[<CLIMutable; NoComparison; NoEquality>]
type Category =
{ /// The ID of the category
@@ -120,7 +120,7 @@ type Page =
text : string
/// Permalinks at which this page may have been previously served (useful for migrated content)
priorPermalinks : string list
priorPermalinks : Permalink list
/// Revisions of this page
revisions : Revision list

View File

@@ -61,6 +61,14 @@ type RevisionSource =
/// HTML
| Html
/// Functions to support revision sources
module RevisionSource =
/// Convert a revision source to a string representation
let toString = function Markdown -> "Markdown" | Html -> "HTML"
/// Convert a string to a revision source
let ofString = function "Markdown" -> Markdown | "HTML" -> Html | x -> invalidArg "string" x
/// A revision of a page or post
[<CLIMutable; NoComparison; NoEquality>]

View File

@@ -1,5 +1,43 @@
namespace MyWebLog.ViewModels
open MyWebLog
open System
/// Details about a page used to display page lists
type DisplayPage =
{ /// The ID of this page
id : string
/// The title of the page
title : string
/// The link at which this page is displayed
permalink : string
/// When this page was published
publishedOn : DateTime
/// When this page was last updated
updatedOn : DateTime
/// Whether this page shows as part of the web log's navigation
showInPageList : bool
/// Is this the default page?
isDefault : bool
}
/// Create a display page from a database page
static member fromPage webLog (page : Page) =
let pageId = PageId.toString page.id
{ id = pageId
title = page.title
permalink = Permalink.toString page.permalink
publishedOn = page.publishedOn
updatedOn = page.updatedOn
showInPageList = page.showInPageList
isDefault = pageId = webLog.defaultPage
}
/// The model to use to allow a user to log on
[<CLIMutable>]
@@ -34,6 +72,42 @@ type DashboardModel =
}
/// View model to edit a page
[<CLIMutable>]
type EditPageModel =
{ /// The ID of the page being edited
pageId : string
/// The title of the page
title : string
/// The permalink for the page
permalink : string
/// Whether this page is shown in the page list
isShownInPageList : bool
/// The source format for the text
source : string
/// The text of the page
text : string
}
/// Create an edit model from an existing page
static member fromPage (page : Page) =
let latest =
match page.revisions |> List.sortByDescending (fun r -> r.asOf) |> List.tryHead with
| Some rev -> rev
| None -> Revision.empty
{ pageId = PageId.toString page.id
title = page.title
permalink = Permalink.toString page.permalink
isShownInPageList = page.showInPageList
source = RevisionSource.toString latest.sourceType
text = latest.text
}
/// View model for editing web log settings
[<CLIMutable>]
type SettingsModel =