WIP on Fluid model/filters
This commit is contained in:
@@ -23,7 +23,6 @@ type ISession with
|
||||
[<Literal>]
|
||||
let MESSAGES = "messages"
|
||||
|
||||
|
||||
/// The HTTP item key for loading the session
|
||||
let private sessionLoadedKey = "session-loaded"
|
||||
|
||||
@@ -132,6 +131,7 @@ let redirectToGet url : HttpHandler = fun _ ctx -> task {
|
||||
}
|
||||
|
||||
/// The MIME type for podcast episode JSON chapters
|
||||
[<Literal>]
|
||||
let JSON_CHAPTERS = "application/json+chapters"
|
||||
|
||||
|
||||
@@ -185,10 +185,10 @@ let viewForTheme themeId template next ctx (viewCtx: AppViewContext) = task {
|
||||
// Render view content...
|
||||
match! Template.Cache.get themeId template ctx.Data with
|
||||
| Ok contentTemplate ->
|
||||
let forLayout = { updated with Content = Template.render contentTemplate updated }
|
||||
let forLayout = { updated with Content = Template.render contentTemplate updated ctx.Data }
|
||||
// ...then render that content with its layout
|
||||
match! Template.Cache.get themeId (if isHtmx ctx then "layout-partial" else "layout") ctx.Data with
|
||||
| Ok layoutTemplate -> return! htmlString (Template.render layoutTemplate forLayout) next ctx
|
||||
| Ok layoutTemplate -> return! htmlString (Template.render layoutTemplate forLayout ctx.Data) next ctx
|
||||
| Error message -> return! Error.server message next ctx
|
||||
| Error message -> return! Error.server message next ctx
|
||||
}
|
||||
@@ -199,7 +199,7 @@ let bareForTheme themeId template next ctx viewCtx = task {
|
||||
let withContent = task {
|
||||
if updated.Content = "" then
|
||||
match! Template.Cache.get themeId template ctx.Data with
|
||||
| Ok contentTemplate -> return Ok { updated with Content = Template.render contentTemplate updated }
|
||||
| Ok contentTemplate -> return Ok { updated with Content = Template.render contentTemplate updated ctx.Data }
|
||||
| Error message -> return Error message
|
||||
else
|
||||
return Ok viewCtx
|
||||
@@ -210,7 +210,7 @@ let bareForTheme themeId template next ctx viewCtx = task {
|
||||
match! Template.Cache.get themeId "layout-bare" ctx.Data with
|
||||
| Ok layoutTemplate ->
|
||||
return!
|
||||
(messagesToHeaders completeCtx.Messages >=> htmlString (Template.render layoutTemplate completeCtx))
|
||||
(messagesToHeaders completeCtx.Messages >=> htmlString (Template.render layoutTemplate completeCtx ctx.Data))
|
||||
next ctx
|
||||
| Error message -> return! Error.server message next ctx
|
||||
| Error message -> return! Error.server message next ctx
|
||||
|
||||
Reference in New Issue
Block a user