mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user