--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-09-28 18:01:56 -07:00

View File

@@ -28,16 +28,16 @@
: null;
IHtmlString sectionHeaderMarkup;
if (firstLevelMenuItem.RouteValues != null || HasText(firstLevelMenuItem.Url)) {
sectionHeaderMarkup = HasText(itemId)
? Html.Link(sectionHeaderText, (string)firstLevelMenuItem.Href, new { @class = itemClassName, id = itemId })
: Html.Link(sectionHeaderText, (string)firstLevelMenuItem.Href, new { @class = itemClassName });
}
else if (firstOfTheSecond != null && firstLevelMenuItem.LinkToFirstChild && (firstOfTheSecond.RouteValues != null || HasText(firstOfTheSecond.Url))) {
if (firstOfTheSecond != null && firstLevelMenuItem.LinkToFirstChild && (firstOfTheSecond.RouteValues != null || HasText(firstOfTheSecond.Url))) {
sectionHeaderMarkup = HasText(itemId)
? Html.Link(sectionHeaderText, (string)firstOfTheSecond.Href, new { @class = itemClassName, id = itemId })
: Html.Link(sectionHeaderText, (string)firstOfTheSecond.Href, new { @class = itemClassName });
}
else if (firstLevelMenuItem.RouteValues != null || HasText(firstLevelMenuItem.Url)) {
sectionHeaderMarkup = HasText(itemId)
? Html.Link(sectionHeaderText, (string)firstLevelMenuItem.Href, new { @class = itemClassName, id = itemId })
: Html.Link(sectionHeaderText, (string)firstLevelMenuItem.Href, new { @class = itemClassName });
}
else {
// if the header isn't linked and there are no children there's no reason for this item in the menu other than to look pretty
if (secondLevelMenuItems.Count() == 0) {
@@ -70,6 +70,8 @@
<ul class="menuItems">
@foreach (var secondLevelMenuItem in secondLevelMenuItems.Where(menuItem => !menuItem.LocalNav)) {
string secondLevelTextHint = secondLevelMenuItem.Text.TextHint;
var firstOfTheThird = ((IEnumerable<dynamic>)secondLevelMenuItem).FirstOrDefault();
var secondLevelItemClassName = HasText(secondLevelTextHint)
? "subnavicon-" + secondLevelTextHint.HtmlClassify()
: "subnavicon";
@@ -82,12 +84,16 @@
}
var secondLevelTag = Tag(secondLevelMenuItem, "li");
var secondLevelUrl = secondLevelMenuItem.Href;
if (firstOfTheThird != null && secondLevelMenuItem.LinkToFirstChild && (firstOfTheThird.RouteValues != null || HasText(firstOfTheThird.Url))) {
secondLevelUrl = firstOfTheThird.Href;
}
@secondLevelTag.StartElement
if (HasText(secondLevelItemId)) {
<a href="@secondLevelMenuItem.Href" class="@secondLevelItemClassName" id="@secondLevelItemId">@secondLevelMenuItem.Text</a>
<a href="@secondLevelUrl" class="@secondLevelItemClassName" id="@secondLevelItemId">@secondLevelMenuItem.Text</a>
}
else {
<a href="@secondLevelMenuItem.Href" class="@secondLevelItemClassName">@secondLevelMenuItem.Text</a>
<a href="@secondLevelUrl" class="@secondLevelItemClassName">@secondLevelMenuItem.Text</a>
}
@secondLevelTag.EndElement
}