From 9c150c490942a76ac85c0df27feba42ca8808231 Mon Sep 17 00:00:00 2001 From: Phap Dieu Duong Date: Mon, 26 Jun 2023 18:23:04 +0800 Subject: [PATCH] load release screenshots --- Source/Website/Controllers/ReleaseController.cs | 6 +++++- Source/Website/Views/Release/ReleaseDetailPage.cshtml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Website/Controllers/ReleaseController.cs b/Source/Website/Controllers/ReleaseController.cs index dfbbe3d..73d600b 100644 --- a/Source/Website/Controllers/ReleaseController.cs +++ b/Source/Website/Controllers/ReleaseController.cs @@ -79,7 +79,11 @@ public async Task ReleaseDetailPage(string? slugId, bool? preview // page data ViewData[PageInfo.SidebarList] = await _context.QueryNewsModels(5); - ViewData["_ReleaseScreenshots"] = await GitHub.GetFilesAsync("releases/screenshots/v9.0-beta-4"); + if (!string.IsNullOrEmpty(model.ScreenshotsDir)) + { + ViewData["_ReleaseScreenshots"] = await GitHub.GetFilesAsync("releases/screenshots", model.ScreenshotsDir); + } + return View("ReleaseDetailPage", model); } diff --git a/Source/Website/Views/Release/ReleaseDetailPage.cshtml b/Source/Website/Views/Release/ReleaseDetailPage.cshtml index 3b9021f..45e556a 100644 --- a/Source/Website/Views/Release/ReleaseDetailPage.cshtml +++ b/Source/Website/Views/Release/ReleaseDetailPage.cshtml @@ -3,7 +3,7 @@ @{ var list = (PaginatedList?)ViewData[PageInfo.SidebarList]; - var screenshots = (List)ViewData["_ReleaseScreenshots"] ?? new(); + var screenshots = ((List?)ViewData["_ReleaseScreenshots"]) ?? new(); }