Render the Business Online menu¶
Emit the favorites and category-grouped navigation menu markup for the current view. Trigger: Razor view calling the helper.
| Field | Value |
|---|---|
| Operation ID | OP-19 |
| Trigger | Razor view calling the helper |
| Inputs | HtmlHelper, MenuViewModel, WebContextViewModel |
| Outputs | Markup written to helper.ViewContext.Writer; the "old school" variants return an HtmlString instead |
| Primary components | MenuExtensions.RenderMenu and RenderTopMenu, plus the legacy RenderOldSchoolMenu and RenderOldSchoolTopMenu |
| Entry point | src/Web.Mvc/Extensions/MenuExtensions.cs |
Steps¶
Enforce.ArgumentNotNullonhelper,menu, andwebContext(BR-01).- Emit the Favorites header containing a hard-coded link to
/MenuCache/frmFavoriteMaint.aspxand open<ul class="nav nav-tabs nav-stacked bo-apps-favorites">. - Emit one
<li>per favorite throughFavoriteLink, which renders<a data-mid="{PageId}" href="/{ApplicationName}/{PageLink}" title="{MenuCategory} - {Tooltip}">{FavoriteName or PageName}</a>. Thetitleattribute is emitted only whenTooltipis non-blank, and the link text falls back toPageNamewhenFavoriteNameis blank (BR-42, BR-43). - Emit the "All Applications" header and a
<ul id="menu">carryingdata-current-app,data-current-item-id,data-expanded(lower-cased boolean), anddata-menu-category— the hooks the client-side script uses to highlight the active item.* - Order items by
MenuCategory, group byMenuCategoryCode, and for each group emit a category anchor plus a nested<ul class="nav nav-list is-hidden">containing one<li>per item rendered throughMenuLink(BR-44). - Write the accumulated string to
helper.ViewContext.Writer. RenderTopMenuemits only the items whoseMenuCategoryCodeequalsmenu.MenuCategory, both upper-cased (BR-45).- The two
RenderOldSchool*helpers produce the same data with the legacy<nav>/<header>markup and render favorites throughMenuLinkrather thanFavoriteLink— so favorite names and category tooltips are not applied on the legacy path.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Razor view calls RenderMenu])
Guard[Guard helper/menu/webContext]
Fav[Emit favorites list]
All[Emit All Applications header]
Group[Group items by category code]
Write[Write markup to ViewContext.Writer]
EndOk([Markup emitted])
Start --> Guard
Guard --> Fav
Fav --> All
All --> Group
Group --> Write
Write --> EndOk
Failure and edge-case behavior¶
- No unexpected failure paths beyond argument-guard exceptions and delegated dependency behavior were identified for this operation.
Related documentation¶
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with**could not be confirmed; treat as unknown until verified.
Sources¶
src/Web.Mvc/Extensions/MenuExtensions.cs