WIP on OpenGraph form; items field complete (#52)
This commit is contained in:
parent
bc1d17d916
commit
9b295263f9
@ -530,6 +530,26 @@ let openGraphTypeTests = testList "OpenGraphType" [
|
||||
(fun () -> ignore (OpenGraphType.Parse "anthology")) "Invalid value should have raised an exception"
|
||||
}
|
||||
]
|
||||
test "Selections succeeds" {
|
||||
let it = OpenGraphType.Selections
|
||||
Expect.hasLength it 13 "There should be 13 selections"
|
||||
Expect.equal (List.head it) ("article", "Article") "Article not found where expected"
|
||||
Expect.equal (it |> List.item 1) ("book", "Book") "Book not found where expected"
|
||||
Expect.equal (it |> List.item 2) ("music.album", "Music: Album") "MusicAlbum not found where expected"
|
||||
Expect.equal (it |> List.item 3) ("music.playlist", "Music: Playlist") "MusicPlaylist not found where expected"
|
||||
Expect.equal
|
||||
(it |> List.item 4)
|
||||
("music.radio_station", "Music: Radio Station")
|
||||
"MusicRadioStation not found where expected"
|
||||
Expect.equal (it |> List.item 5) ("music.song", "Music: Song") "MusicSong not found where expected"
|
||||
Expect.equal (it |> List.item 6) ("payment.link", "Payment Link") "PaymentLink not found where expected"
|
||||
Expect.equal (it |> List.item 7) ("profile", "Profile") "Profile not found where expected"
|
||||
Expect.equal (it |> List.item 8) ("video.episode", "Video: Episode") "VideoEpisode not found where expected"
|
||||
Expect.equal (it |> List.item 9) ("video.movie", "Video: Movie") "VideoMovie not found where expected"
|
||||
Expect.equal (it |> List.item 10) ("video.other", "Video: Other") "VideoOther not found where expected"
|
||||
Expect.equal (it |> List.item 11) ("video.tv_show", "Video: TV Show") "VideoTvShow not found where expected"
|
||||
Expect.equal (it |> List.item 12) ("website", "Website") "Website not found where expected"
|
||||
}
|
||||
testList "ToString" [
|
||||
test "succeeds for Article" {
|
||||
Expect.equal (string Article) "article" "Article string incorrect"
|
||||
|
@ -393,7 +393,7 @@ let commonTemplates (model: EditCommonModel) (templates: MetaItem seq) =
|
||||
/// <param name="model">The edit model</param>
|
||||
/// <returns>Fields for editing OpenGraph data for a page or post</returns>
|
||||
let commonOpenGraph (model: EditCommonModel) =
|
||||
fieldset [] [
|
||||
fieldset [ _class "mb-3" ] [
|
||||
legend [] [
|
||||
span [ _class "form-check form-switch" ] [
|
||||
small [] [
|
||||
@ -406,29 +406,45 @@ let commonOpenGraph (model: EditCommonModel) =
|
||||
]
|
||||
]
|
||||
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 []
|
||||
fieldset [ _id "og_item" ] [
|
||||
legend [] [ raw "Item Details" ]
|
||||
div [ _class "row p-0" ] [
|
||||
div [ _class "mb-3 col-xs-6 col-md-3" ] [
|
||||
selectField [ _required ] (nameof model.OpenGraphType) "Type" model.OpenGraphType
|
||||
OpenGraphType.Selections fst snd []
|
||||
]
|
||||
div [ _class "mb-3 col-xs-6 col-md-3" ] [
|
||||
textField [] (nameof model.OpenGraphLocale) "Locale" model.OpenGraphLocale
|
||||
[ span [ _class "form-text" ] [ raw "ex. en-US" ] ]
|
||||
]
|
||||
div [ _class "mb-3 col-xs-6 col-md-4" ] [
|
||||
textField [] (nameof model.OpenGraphAlternateLocales) "Alternate Locales"
|
||||
model.OpenGraphAlternateLocales
|
||||
[ span [ _class "form-text" ] [ raw "comma separated" ] ]
|
||||
]
|
||||
div [ _class "mb-3 col-xs-6 col-md-2" ] [
|
||||
textField [] (nameof model.OpenGraphDeterminer) "Determiner" model.OpenGraphDeterminer
|
||||
[ span [ _class "form-text" ] [ raw "a/an/the"; br []; raw "(blank = auto)" ] ]
|
||||
]
|
||||
div [ _class "mb-3 col-12" ] [
|
||||
textField [] (nameof model.OpenGraphDescription) "Short Description" model.OpenGraphDescription
|
||||
[]
|
||||
]
|
||||
]
|
||||
// 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 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
|
||||
]
|
||||
// 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
|
||||
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -227,6 +227,15 @@ this.Admin = {
|
||||
if (link) link.style.display = src === "none" || src === "external" ? "none" : ""
|
||||
},
|
||||
|
||||
/**
|
||||
* Enable or disable OpenGraph fields
|
||||
*/
|
||||
toggleOpenGraphFields() {
|
||||
const disabled = !document.getElementById("AssignOpenGraph").checked
|
||||
let fieldsets = ["og_item"]
|
||||
fieldsets.forEach(it => document.getElementById(it).disabled = disabled)
|
||||
},
|
||||
|
||||
/**
|
||||
* Enable or disable podcast fields
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user