From 7203fa5a385350646f942dde405f52b087e2ab63 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Mon, 27 Jun 2022 22:16:53 -0400 Subject: [PATCH] Invalidate cache when theme uploaded (#12) - Add episode to display page (leftover from #9) - Show episode label based on structure (also #9) --- src/MyWebLog.Domain/ViewModels.fs | 4 ++++ src/MyWebLog/DotLiquidBespoke.fs | 3 ++- src/MyWebLog/Handlers/Admin.fs | 1 + src/admin-theme/post-edit.liquid | 6 ++++-- src/admin-theme/post-list.liquid | 5 +---- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/MyWebLog.Domain/ViewModels.fs b/src/MyWebLog.Domain/ViewModels.fs index 06d4848..5e336c8 100644 --- a/src/MyWebLog.Domain/ViewModels.fs +++ b/src/MyWebLog.Domain/ViewModels.fs @@ -745,6 +745,9 @@ type PostListItem = /// Tags for the post tags : string list + /// The podcast episode information for this post + episode : Episode option + /// Metadata for the post metadata : MetaItem list } @@ -763,6 +766,7 @@ type PostListItem = text = if extra = "" then post.text else post.text.Replace ("href=\"/", $"href=\"{extra}/") categoryIds = post.categoryIds |> List.map CategoryId.toString tags = post.tags + episode = post.episode metadata = post.metadata } diff --git a/src/MyWebLog/DotLiquidBespoke.fs b/src/MyWebLog/DotLiquidBespoke.fs index 79fc22c..c74bb9d 100644 --- a/src/MyWebLog/DotLiquidBespoke.fs +++ b/src/MyWebLog/DotLiquidBespoke.fs @@ -223,7 +223,8 @@ let register () = Template.RegisterTag "user_links" [ // Domain types - typeof; typeof; typeof; typeof; typeof; typeof + typeof; typeof; typeof; typeof; typeof; typeof + typeof; typeof // View models typeof; typeof; typeof; typeof typeof; typeof; typeof; typeof diff --git a/src/MyWebLog/Handlers/Admin.fs b/src/MyWebLog/Handlers/Admin.fs index b31c23c..6342bbd 100644 --- a/src/MyWebLog/Handlers/Admin.fs +++ b/src/MyWebLog/Handlers/Admin.fs @@ -440,6 +440,7 @@ let updateTheme : HttpHandler = fun next ctx -> task { do! themeFile.CopyToAsync stream do! loadThemeFromZip themeName stream true data do! ThemeAssetCache.refreshTheme (ThemeId themeName) data + TemplateCache.invalidateTheme themeName do! addMessage ctx { UserMessage.success with message = "Theme updated successfully" } return! redirectToGet (WebLog.relativeUrl ctx.WebLog (Permalink "admin/dashboard")) next ctx | Ok _ -> diff --git a/src/admin-theme/post-edit.liquid b/src/admin-theme/post-edit.liquid index de9cc7c..f669821 100644 --- a/src/admin-theme/post-edit.liquid +++ b/src/admin-theme/post-edit.liquid @@ -66,7 +66,9 @@ -
Path to media; relative URL will be appended to base media path
+
+ Relative URL will be appended to base media path (if set) or served from this web log +
@@ -169,7 +171,7 @@ placeholder="Transcript Type" value="{{ model.transcript_type }}" {%- if model.transcript_url != "" %} required{% endif %}> -
Recommended if transcript file provided
+
Required if transcript URL provided
diff --git a/src/admin-theme/post-list.liquid b/src/admin-theme/post-list.liquid index 722c1f8..a952cdd 100644 --- a/src/admin-theme/post-list.liquid +++ b/src/admin-theme/post-list.liquid @@ -42,10 +42,7 @@
- {%- assign media = post.metadata | value: "episode_media_file" -%} - {%- unless media == "-- episode_media_file not found --" -%} - Episode - {%- endunless -%} + {%- if post.episode %}Episode{% endif -%} {{ post.title }}
View Post