From aa1e1bd5fb20f54330815aacd225a30cc88870cc Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Thu, 23 Nov 2023 13:01:29 -0800 Subject: [PATCH] Pre-render Navbar to allow resource injection (#14747) --- src/OrchardCore.Themes/TheAdmin/Views/Layout.cshtml | 5 +++-- src/OrchardCore.Themes/TheTheme/Views/Layout.cshtml | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/OrchardCore.Themes/TheAdmin/Views/Layout.cshtml b/src/OrchardCore.Themes/TheAdmin/Views/Layout.cshtml index 80381739a72..bf474f4e1fa 100644 --- a/src/OrchardCore.Themes/TheAdmin/Views/Layout.cshtml +++ b/src/OrchardCore.Themes/TheAdmin/Views/Layout.cshtml @@ -10,8 +10,9 @@ @{ var adminSettings = Site.As(); - // Branding is pre-rendered to allow resource injection + // Branding and Navbar are pre-rendered to allow resource injection var brandingHtml = await DisplayAsync(await New.AdminBranding()); + var navbar = await DisplayManager.BuildDisplayAsync(UpdateModelAccessor.ModelUpdater, "DetailAdmin"); } @@ -60,7 +61,7 @@ } - @await DisplayAsync(await DisplayManager.BuildDisplayAsync(UpdateModelAccessor.ModelUpdater, "DetailAdmin")) + @await DisplayAsync(navbar) diff --git a/src/OrchardCore.Themes/TheTheme/Views/Layout.cshtml b/src/OrchardCore.Themes/TheTheme/Views/Layout.cshtml index 4acac82ddf6..af4d696e497 100644 --- a/src/OrchardCore.Themes/TheTheme/Views/Layout.cshtml +++ b/src/OrchardCore.Themes/TheTheme/Views/Layout.cshtml @@ -10,6 +10,8 @@ @inject ThemeTogglerService ThemeTogglerService @{ var adminSettings = Site.As(); + // Navbar is pre-rendered to allow resource injection + var navbar = await DisplayManager.BuildDisplayAsync(UpdateModelAccessor.ModelUpdater); } @@ -49,7 +51,7 @@