Version 2.1 #41

Merged
danieljsummers merged 123 commits from version-2.1 into main 2024-03-27 00:13:28 +00:00
5 changed files with 24 additions and 10 deletions
Showing only changes of commit d1a9606c5c - Show all commits

View File

@ -145,7 +145,7 @@ type SQLitePostData(conn: SqliteConnection, log: ILogger) =
let tagSql, tagParams = inJsonArray Table.Post (nameof Post.Empty.Tags) "tag" [ tag ] let tagSql, tagParams = inJsonArray Table.Post (nameof Post.Empty.Tags) "tag" [ tag ]
conn.customList conn.customList
$"{publishedPostByWebLog} AND {tagSql} $"{publishedPostByWebLog} AND {tagSql}
ORDER BY p.published_on DESC ORDER BY {publishField} DESC
LIMIT {postsPerPage + 1} OFFSET {(pageNbr - 1) * postsPerPage}" LIMIT {postsPerPage + 1} OFFSET {(pageNbr - 1) * postsPerPage}"
(webLogParam webLogId :: tagParams) (webLogParam webLogId :: tagParams)
fromData<Post> fromData<Post>

View File

@ -205,12 +205,13 @@ type DisplayTheme = {
/// Create a display theme from a theme /// Create a display theme from a theme
static member FromTheme inUseFunc (theme: Theme) = static member FromTheme inUseFunc (theme: Theme) =
let fileName = if string theme.Id = "default" then "default-theme.zip" else $"./themes/{theme.Id}-theme.zip"
{ Id = string theme.Id { Id = string theme.Id
Name = theme.Name Name = theme.Name
Version = theme.Version Version = theme.Version
TemplateCount = List.length theme.Templates TemplateCount = List.length theme.Templates
IsInUse = inUseFunc theme.Id IsInUse = inUseFunc theme.Id
IsOnDisk = File.Exists $"{theme.Id}-theme.zip" } IsOnDisk = File.Exists fileName }
/// Information about an uploaded file used for display /// Information about an uploaded file used for display

View File

@ -175,8 +175,9 @@ let displayThemeTests = testList "DisplayTheme.FromTheme" [
Expect.isTrue model.IsInUse "IsInUse should have been set" Expect.isTrue model.IsInUse "IsInUse should have been set"
Expect.isFalse model.IsOnDisk "IsOnDisk should not have been set" Expect.isFalse model.IsOnDisk "IsOnDisk should not have been set"
} }
test "succeeds when the theme is not in use as is on disk" { test "succeeds when a non-default theme is not in use and is on disk" {
let file = File.Create "another-theme.zip" let dir = Directory.CreateDirectory "themes"
let file = File.Create "./themes/another-theme.zip"
try try
let model = DisplayTheme.FromTheme (fun _ -> false) { theme with Id = ThemeId "another" } let model = DisplayTheme.FromTheme (fun _ -> false) { theme with Id = ThemeId "another" }
Expect.isFalse model.IsInUse "IsInUse should not have been set" Expect.isFalse model.IsInUse "IsInUse should not have been set"
@ -184,7 +185,19 @@ let displayThemeTests = testList "DisplayTheme.FromTheme" [
finally finally
file.Close() file.Close()
file.Dispose() file.Dispose()
File.Delete "another-theme.zip" File.Delete "./themes/another-theme.zip"
dir.Delete()
}
test "succeeds when the default theme is on disk" {
let file = File.Create "./default-theme.zip"
try
Expect.isTrue
(DisplayTheme.FromTheme (fun _ -> false) { theme with Id = ThemeId "default" }).IsOnDisk
"IsOnDisk should have been set"
finally
file.Close()
file.Dispose()
File.Delete "./default-theme.zip"
} }
] ]

View File

@ -42,7 +42,7 @@
<div class="col-1 d-flex justify-content-end pb-3"> <div class="col-1 d-flex justify-content-end pb-3">
<div class="form-check form-check-inline me-0"> <div class="form-check form-check-inline me-0">
<input type=radio name=SourceType id=sourceTypeCat class=form-check-input value=category <input type=radio name=SourceType id=sourceTypeCat class=form-check-input value=category
{%- unless typ == "tag" %} checked {% endunless -%}onclick="Admin.customFeedBy('category')"> {%- unless typ == "tag" %} checked{% endunless %} onclick="Admin.customFeedBy('category')">
<label for=sourceTypeCat class="form-check-label d-none">Category</label> <label for=sourceTypeCat class="form-check-label d-none">Category</label>
</div> </div>
</div> </div>

View File

@ -145,7 +145,7 @@
</div> </div>
<div class="form-check form-switch pb-2"> <div class="form-check form-switch pb-2">
<input type=checkbox name=IsTagEnabled id=tagEnabled class=form-check-input value=true <input type=checkbox name=IsTagEnabled id=tagEnabled class=form-check-input value=true
{%- if rss_model.tag_enabled %} checked{% endif %}> {%- if rss_model.is_tag_enabled %} checked{% endif %}>
<label for=tagEnabled class=form-check-label>Posts by Tag</label> <label for=tagEnabled class=form-check-label>Posts by Tag</label>
</div> </div>
</fieldset> </fieldset>