Skip to content

Commit

Permalink
Cleanup Navbar (#15595)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Mar 26, 2024
1 parent 5d4b52d commit 471850f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
9 changes: 0 additions & 9 deletions src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,6 @@ public override void ConfigureServices(IServiceCollection services)

return NilValue.Instance;
}));

o.MemberAccessStrategy.Register<Navbar, FluidValue>((navbar, name, context) =>
{
return name switch
{
nameof(Navbar.Properties) => new ObjectValue(navbar.Properties),
_ => NilValue.Instance
};
});
});
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/OrchardCore.Modules/OrchardCore.Admin/Views/Navbar.cshtml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
@using OrchardCore.Admin.Models
@using OrchardCore.DisplayManagement
@using OrchardCore.DisplayManagement.ModelBinding
@using OrchardCore.DisplayManagement.Zones

@inject IDisplayManager<Navbar> DisplayManager
@inject IUpdateModelAccessor UpdateModelAccessor

@if (Model.Content == null)
{
dynamic shape = await DisplayAsync(await DisplayManager.BuildDisplayAsync(UpdateModelAccessor.ModelUpdater, (string)Model.Metadata.DisplayType));
var shape = await DisplayManager.BuildDisplayAsync(UpdateModelAccessor.ModelUpdater, (string)Model.Metadata.DisplayType);

if (shape.Content == null)
if (!shape.TryGetProperty<IShape>("Content", out var content))
{
return;
}

Model.Content = shape.Content;
Model.Content = content;
}

<ul class="navbar-nav user-top-navbar">
Expand Down

0 comments on commit 471850f

Please sign in to comment.