#19850: Only link to the first child if it also has the same "effective" url as its parent.

Work Item: 19850
This commit is contained in:
Sipke Schoorstra
2013-08-07 01:29:22 -07:00
parent 9338c96e3b
commit 4d5e51ccf5

View File

@@ -20,6 +20,7 @@
string sectionHeaderText = firstLevelMenuItem.Text.Text;
string sectionHeaderTextHint = firstLevelMenuItem.Text.TextHint;
var firstOfTheSecond = secondLevelMenuItems.FirstOrDefault();
var firstLevelMenuItemUrl = firstLevelMenuItem.Href;
var itemClassName = HasText(sectionHeaderTextHint)
? "navicon-" + sectionHeaderTextHint.HtmlClassify()
@@ -34,6 +35,7 @@
&& (
firstOfTheSecond.RouteValues != null
|| HasText(firstOfTheSecond.Url))) {
firstLevelMenuItemUrl = firstOfTheSecond.Href;
sectionHeaderMarkup = HasText(itemId)
? Html.Link(sectionHeaderText, (string)firstOfTheSecond.Href, new { @class = itemClassName, id = itemId })
: Html.Link(sectionHeaderText, (string)firstOfTheSecond.Href, new { @class = itemClassName });
@@ -75,7 +77,7 @@
<ul class="menuItems">
@{ var first = true;}
@foreach (var secondLevelMenuItem in secondLevelMenuItems.Where(menuItem => !menuItem.LocalNav)) {
if (first && firstLevelMenuItem.LinkToFirstChild) {
if (first && firstLevelMenuItem.LinkToFirstChild && String.Equals(firstLevelMenuItemUrl, secondLevelMenuItem.Href)) {
first = false;
continue;
}