WIP on OpenGraph edit form (#52)
This commit is contained in:
parent
cba1bbfa28
commit
bc1d17d916
@ -581,6 +581,22 @@ type OpenGraphType =
|
||||
| "website" -> Website
|
||||
| _ -> invalidArg (nameof typ) $"{typ} is not a valid OpenGraph type"
|
||||
|
||||
/// <summary>The values and display names for valid values of this type</summary>
|
||||
static member Selections =
|
||||
[ string Article, nameof Article
|
||||
string Book, nameof Book
|
||||
string MusicAlbum, "Music: Album"
|
||||
string MusicPlaylist, "Music: Playlist"
|
||||
string MusicRadioStation, "Music: Radio Station"
|
||||
string MusicSong, "Music: Song"
|
||||
string PaymentLink, "Payment Link"
|
||||
string Profile, nameof Profile
|
||||
string VideoEpisode, "Video: Episode"
|
||||
string VideoMovie, "Video: Movie"
|
||||
string VideoOther, "Video: Other"
|
||||
string VideoTvShow, "Video: TV Show"
|
||||
string Website, nameof Website ]
|
||||
|
||||
override this.ToString() =
|
||||
match this with
|
||||
| Article -> "article"
|
||||
|
@ -389,6 +389,49 @@ let commonTemplates (model: EditCommonModel) (templates: MetaItem seq) =
|
||||
_.Name _.Value []
|
||||
|
||||
|
||||
/// <summary>Display the OpenGraph data edit form</summary>
|
||||
/// <param name="model">The edit model</param>
|
||||
/// <returns>Fields for editing OpenGraph data for a page or post</returns>
|
||||
let commonOpenGraph (model: EditCommonModel) =
|
||||
fieldset [] [
|
||||
legend [] [
|
||||
span [ _class "form-check form-switch" ] [
|
||||
small [] [
|
||||
input [ _type "checkbox"; _name (nameof model.AssignOpenGraph)
|
||||
_id (nameof model.AssignOpenGraph); _class "form-check-input"; _value "true"
|
||||
_data "bs-toggle" "collapse"; _data "bs-target" "#og_props"
|
||||
_onclick "Admin.toggleOpenGraphFields()"; if model.AssignOpenGraph then _checked ]
|
||||
]
|
||||
label [ _for (nameof model.AssignOpenGraph) ] [ raw "OpenGraph Properties" ]
|
||||
]
|
||||
]
|
||||
div [ _id "og_props"; _class $"""container p-0 collapse{if model.AssignOpenGraph then " show" else ""}""" ] [
|
||||
div [ _class "col-4" ] [
|
||||
selectField [ _required ] (nameof model.OpenGraphType) "Type" model.OpenGraphType
|
||||
OpenGraphType.Selections fst snd []
|
||||
]
|
||||
// member val OpenGraphType = "" with get, set
|
||||
// member val OpenGraphImageUrl = "" with get, set
|
||||
// member val OpenGraphImageType = "" with get, set
|
||||
// member val OpenGraphImageWidth = "" with get, set
|
||||
// member val OpenGraphImageHeight = "" with get, set
|
||||
// member val OpenGraphImageAlt = "" with get, set
|
||||
// member val OpenGraphAudioUrl = "" with get, set
|
||||
// member val OpenGraphAudioType = "" with get, set
|
||||
// member val OpenGraphDescription = "" with get, set
|
||||
// member val OpenGraphDeterminer = "" with get, set
|
||||
// member val OpenGraphLocale = "" with get, set
|
||||
// member val OpenGraphAlternateLocales = "" with get, set
|
||||
// member val OpenGraphVideoUrl = "" with get, set
|
||||
// member val OpenGraphVideoType = "" with get, set
|
||||
// member val OpenGraphVideoWidth = "" with get, set
|
||||
// member val OpenGraphVideoHeight = "" with get, set
|
||||
// member val OpenGraphExtraNames: string array = [||] with get, set
|
||||
// member val OpenGraphExtraValues: string array = [||] with get, set
|
||||
|
||||
]
|
||||
]
|
||||
|
||||
/// <summary>Display the metadata item edit form</summary>
|
||||
/// <param name="model">The edit model</param>
|
||||
/// <returns>A form for editing metadata</returns>
|
||||
|
@ -291,6 +291,7 @@ let postEdit (model: EditPostModel) templates (ratings: MetaItem list) app = [
|
||||
checkboxSwitch [ _class "mb-2" ] (nameof model.DoPublish) "Publish This Post" model.DoPublish []
|
||||
saveButton
|
||||
hr [ _class "mb-3" ]
|
||||
commonOpenGraph model
|
||||
fieldset [ _class "mb-3" ] [
|
||||
legend [] [
|
||||
span [ _class "form-check form-switch" ] [
|
||||
|
Loading…
x
Reference in New Issue
Block a user