From 43557e5cf7dcc9c385638ff1a181ec03f9327a21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=CC=8Akan=20Edling?= Date: Thu, 7 Jan 2021 13:12:35 +0100 Subject: [PATCH] Upgraded web projects to .NET 5. Added error handling to ImageGallerBlock, fixes #37 --- src/web/mvc/MvcWeb.csproj | 34 +++++++++---------- .../DisplayTemplates/ImageGalleryBlock.cshtml | 9 +++-- .../DisplayTemplates/ImageGalleryBlock.cshtml | 9 +++-- src/web/razor/RazorWeb.csproj | 34 +++++++++---------- 4 files changed, 46 insertions(+), 40 deletions(-) diff --git a/src/web/mvc/MvcWeb.csproj b/src/web/mvc/MvcWeb.csproj index f52400c..0e3b137 100644 --- a/src/web/mvc/MvcWeb.csproj +++ b/src/web/mvc/MvcWeb.csproj @@ -1,26 +1,26 @@ - netcoreapp3.1 + net5.0 - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/web/mvc/Views/Cms/DisplayTemplates/ImageGalleryBlock.cshtml b/src/web/mvc/Views/Cms/DisplayTemplates/ImageGalleryBlock.cshtml index 077dc4b..aaae643 100644 --- a/src/web/mvc/Views/Cms/DisplayTemplates/ImageGalleryBlock.cshtml +++ b/src/web/mvc/Views/Cms/DisplayTemplates/ImageGalleryBlock.cshtml @@ -2,19 +2,22 @@ @using Piranha.Extend.Blocks @{ var unique = "gallery-" + Guid.NewGuid().ToString(); + var images = Model.Items + .Where(i => i.GetType() == typeof(ImageBlock) && ((ImageBlock)i).Body.HasValue) + .ToList(); }