Skip to content

Commit

Permalink
feat: Enable the sub-menu to match multiple levels in the page URL
Browse files Browse the repository at this point in the history
Merge pull request #288 from DFE-Digital/feat/sub-menu-matching
  • Loading branch information
killij authored Sep 28, 2023
2 parents f4a42f9 + 7c026e4 commit 9170780
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Childrens-Social-Care-CPD/Views/Shared/_SideMenu.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<ul class="dfe-vertical-nav__section">
@foreach (var menuItem in Model.Items)
{
var css = ViewBag.ContextModel.PageName == menuItem.Uri
string pageName = $"/{ViewBag.ContextModel.PageName}";
string uri = menuItem.Uri.StartsWith('/') ? menuItem.Uri : $"/{menuItem.Uri}";
var css = pageName.StartsWith(uri)
? "dfe-vertical-nav__section-item dfe-vertical-nav__section-item--current"
: "dfe-vertical-nav__section-item";

Expand Down

0 comments on commit 9170780

Please sign in to comment.