WIP on htmx 4 integration (#60)
This commit is contained in:
@@ -203,18 +203,18 @@ module Layout =
|
||||
/// Create a navigation link
|
||||
let private navLink app name url =
|
||||
let extraPath = app.WebLog.ExtraPath
|
||||
let path = if extraPath = "" then "" else $"{extraPath[1..]}/"
|
||||
let active = if app.CurrentPage.StartsWith $"{path}{url}" then " active" else ""
|
||||
li [ _class "nav-item" ] [
|
||||
a [ _class $"nav-link{active}"; _href (relUrl app url) ] [ txt name ]
|
||||
]
|
||||
let path = if extraPath = "" then "" else $"{extraPath[1..]}/"
|
||||
let active = if app.CurrentPage.StartsWith $"{path}{url}" then " active" else ""
|
||||
let linkUrl = relUrl app url
|
||||
li [ _class "nav-item" ] [ a [ _class $"nav-link{active}"; _href linkUrl; _hxBoost ] [ txt name ] ]
|
||||
|
||||
/// Create a page view for the given content
|
||||
let private pageView (content: AppViewContext -> XmlNode list) app = [
|
||||
header [] [
|
||||
nav [ _class "navbar navbar-dark bg-dark navbar-expand-md justify-content-start px-2 position-fixed top-0 w-100" ] [
|
||||
nav [ _class "navbar navbar-dark bg-dark navbar-expand-md justify-content-start px-2 position-fixed top-0 w-100"
|
||||
hxInherited (_hxTarget "body") ] [
|
||||
div [ _class "container-fluid" ] [
|
||||
a [ _class "navbar-brand"; _href (relUrl app ""); _hxNoBoost ] [ txt app.WebLog.Name ]
|
||||
a [ _class "navbar-brand"; _href (relUrl app "") ] [ txt app.WebLog.Name ]
|
||||
button [ _type "button"; _class "navbar-toggler"; _data "bs-toggle" "collapse"
|
||||
_data "bs-target" "#navbarText"; _ariaControls "navbarText"; _ariaExpanded "false"
|
||||
_ariaLabel "Toggle navigation" ] [
|
||||
@@ -244,9 +244,7 @@ module Layout =
|
||||
]
|
||||
if app.IsLoggedOn then
|
||||
li [ _class "nav-item" ] [
|
||||
a [ _class "nav-link"; _hxPost (relUrl app "user/log-off"); _hxNoBoost ] [
|
||||
raw "Log Off"
|
||||
]
|
||||
a [ _class "nav-link"; _hxPost (relUrl app "user/log-off") ] [ raw "Log Off" ]
|
||||
]
|
||||
else
|
||||
navLink app "Log On" "user/log-on"
|
||||
@@ -313,7 +311,7 @@ module Layout =
|
||||
_integrity "sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
|
||||
_crossorigin "anonymous" ]
|
||||
link [ _rel "stylesheet"; _href (relUrl app "themes/admin/admin.css") ]
|
||||
body [ _hxBoost; _hxIndicator "#loadOverlay" ] [
|
||||
body [ hxInherited (_hxIndicator "#loadOverlay"); hxInherited (_hxTarget "body") ] [
|
||||
yield! pageView content app
|
||||
script [ _src "https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
||||
_integrity "sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
||||
@@ -362,7 +360,7 @@ let commonEdit (model: EditCommonModel) app = [
|
||||
]
|
||||
]
|
||||
div [ _class "mb-2" ] [
|
||||
label [ _for "text" ] [ raw "Text" ]; raw " "
|
||||
raw "Text"; raw " "
|
||||
div [ _class "btn-group btn-group-sm"; _roleGroup; _ariaLabel "Text format button group" ] [
|
||||
input [ _type "radio"; _name (nameof model.Source); _id "source_html"; _class "btn-check"
|
||||
_value "HTML"; if model.Source = "HTML" then _checked ]
|
||||
|
||||
Reference in New Issue
Block a user