Invalidate cache when theme uploaded (#12)

- Add episode to display page (leftover from #9)
- Show episode label based on structure (also #9)
This commit is contained in:
Daniel J. Summers 2022-06-27 22:16:53 -04:00
parent 16603bbcaf
commit 7203fa5a38
5 changed files with 12 additions and 7 deletions

View File

@ -745,6 +745,9 @@ type PostListItem =
/// Tags for the post /// Tags for the post
tags : string list tags : string list
/// The podcast episode information for this post
episode : Episode option
/// Metadata for the post /// Metadata for the post
metadata : MetaItem list metadata : MetaItem list
} }
@ -763,6 +766,7 @@ type PostListItem =
text = if extra = "" then post.text else post.text.Replace ("href=\"/", $"href=\"{extra}/") text = if extra = "" then post.text else post.text.Replace ("href=\"/", $"href=\"{extra}/")
categoryIds = post.categoryIds |> List.map CategoryId.toString categoryIds = post.categoryIds |> List.map CategoryId.toString
tags = post.tags tags = post.tags
episode = post.episode
metadata = post.metadata metadata = post.metadata
} }

View File

@ -223,7 +223,8 @@ let register () =
Template.RegisterTag<UserLinksTag> "user_links" Template.RegisterTag<UserLinksTag> "user_links"
[ // Domain types [ // Domain types
typeof<CustomFeed>; typeof<MetaItem>; typeof<Page>; typeof<RssOptions>; typeof<TagMap>; typeof<WebLog> typeof<CustomFeed>; typeof<Episode>; typeof<Episode option>; typeof<MetaItem>; typeof<Page>; typeof<RssOptions>
typeof<TagMap>; typeof<WebLog>
// View models // View models
typeof<DashboardModel>; typeof<DisplayCategory>; typeof<DisplayCustomFeed>; typeof<DisplayPage> typeof<DashboardModel>; typeof<DisplayCategory>; typeof<DisplayCustomFeed>; typeof<DisplayPage>
typeof<EditCategoryModel>; typeof<EditCustomFeedModel>; typeof<EditPageModel>; typeof<EditPostModel> typeof<EditCategoryModel>; typeof<EditCustomFeedModel>; typeof<EditPageModel>; typeof<EditPostModel>

View File

@ -440,6 +440,7 @@ let updateTheme : HttpHandler = fun next ctx -> task {
do! themeFile.CopyToAsync stream do! themeFile.CopyToAsync stream
do! loadThemeFromZip themeName stream true data do! loadThemeFromZip themeName stream true data
do! ThemeAssetCache.refreshTheme (ThemeId themeName) data do! ThemeAssetCache.refreshTheme (ThemeId themeName) data
TemplateCache.invalidateTheme themeName
do! addMessage ctx { UserMessage.success with message = "Theme updated successfully" } do! addMessage ctx { UserMessage.success with message = "Theme updated successfully" }
return! redirectToGet (WebLog.relativeUrl ctx.WebLog (Permalink "admin/dashboard")) next ctx return! redirectToGet (WebLog.relativeUrl ctx.WebLog (Permalink "admin/dashboard")) next ctx
| Ok _ -> | Ok _ ->

View File

@ -66,7 +66,9 @@
<input type="text" name="media" id="media" class="form-control" placeholder="Media" required <input type="text" name="media" id="media" class="form-control" placeholder="Media" required
value="{{ model.media }}"> value="{{ model.media }}">
<label for="media">Media File</label> <label for="media">Media File</label>
<div class="form-text">Path to media; relative URL will be appended to base media path</div> <div class="form-text">
Relative URL will be appended to base media path (if set) or served from this web log
</div>
</div> </div>
</div> </div>
<div class="col-12 col-md-4 pb-3"> <div class="col-12 col-md-4 pb-3">
@ -169,7 +171,7 @@
placeholder="Transcript Type" value="{{ model.transcript_type }}" placeholder="Transcript Type" value="{{ model.transcript_type }}"
{%- if model.transcript_url != "" %} required{% endif %}> {%- if model.transcript_url != "" %} required{% endif %}>
<label for="transcriptType">Transcript MIME Type</label> <label for="transcriptType">Transcript MIME Type</label>
<div class="form-text">Recommended if transcript file provided</div> <div class="form-text">Required if transcript URL provided</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -42,10 +42,7 @@
</span> </span>
</div> </div>
<div class="{{ title_col }}"> <div class="{{ title_col }}">
{%- assign media = post.metadata | value: "episode_media_file" -%} {%- if post.episode %}<span class="badge bg-success float-end text-uppercase">Episode</span>{% endif -%}
{%- unless media == "-- episode_media_file not found --" -%}
<span class="badge bg-success float-end text-uppercase">Episode</span>
{%- endunless -%}
{{ post.title }}<br> {{ post.title }}<br>
<small> <small>
<a href="{{ post | relative_link }}" target="_blank">View Post</a> <a href="{{ post | relative_link }}" target="_blank">View Post</a>