Skip to content

Commit

Permalink
Pre-render Navbar to allow resource injection
Browse files Browse the repository at this point in the history
Fix #14747
  • Loading branch information
MikeAlhayek committed Nov 25, 2023
1 parent 8f4e3ad commit 2072fff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/OrchardCore.Themes/TheAdmin/Views/Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
@{
var adminSettings = Site.As<AdminSettings>();

// Branding and Navbar are 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<Navbar>(UpdateModelAccessor.ModelUpdater, "DetailAdmin");
var navbar = await DisplayAsync(await DisplayManager.BuildDisplayAsync<Navbar>(UpdateModelAccessor.ModelUpdater, "DetailAdmin"));
}
<!DOCTYPE html>
<html lang="@Orchard.CultureName()" dir="@Orchard.CultureDir()" data-bs-theme="@await ThemeTogglerService.CurrentTheme()" data-tenant="@ThemeTogglerService.CurrentTenant">
Expand Down Expand Up @@ -61,7 +61,7 @@
}
</div>
</div>
@await DisplayAsync(navbar)
@navbar
</div>
</div>
</nav>
Expand Down
6 changes: 3 additions & 3 deletions src/OrchardCore.Themes/TheTheme/Views/Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
@inject ThemeTogglerService ThemeTogglerService
@{
var adminSettings = Site.As<AdminSettings>();
// Navbar is pre-rendered to allow resource injection
var navbar = await DisplayManager.BuildDisplayAsync<Navbar>(UpdateModelAccessor.ModelUpdater);
// Navbar is pre-rendered to allow resource injection.
var navbar = await DisplayAsync(await DisplayManager.BuildDisplayAsync<Navbar>(UpdateModelAccessor.ModelUpdater));
}
<!DOCTYPE html>
<html lang="@Orchard.CultureName()" dir="@Orchard.CultureDir()" data-bs-theme="@await ThemeTogglerService.CurrentTheme()" data-tenant="@ThemeTogglerService.CurrentTenant">
Expand Down Expand Up @@ -51,7 +51,7 @@
<div class="collapse navbar-collapse" id="navbar">
<div class="d-flex w-100 align-items-end justify-content-end justify-content-md-between flex-column flex-md-row">
<menu alias="alias:main-menu" cache-id="main-menu" cache-fixed-duration="00:05:00" cache-tag="alias:main-menu" />
@await DisplayAsync(navbar)
@navbar
</div>
</div>
</div>
Expand Down

0 comments on commit 2072fff

Please sign in to comment.