mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Adding the "current" class back to the current menu item
--HG-- branch : dev
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
@{
|
||||
// odd formatting in this file is to cause more attractive results in the output.
|
||||
var items = (IEnumerable<dynamic>)Enumerable.Cast<dynamic>(Model);
|
||||
// odd formatting in this file is to cause more attractive results in the output.
|
||||
var items = (IEnumerable<dynamic>)Enumerable.Cast<dynamic>(Model);
|
||||
}
|
||||
@{
|
||||
if (string.IsNullOrWhiteSpace((string)Model.Text)) {
|
||||
if (!HasText(Model.Text)) {
|
||||
@DisplayChildren(Model)
|
||||
} else {
|
||||
<li><a href="@Model.Href">@Model.Text</a>
|
||||
@if (items.Any()) {
|
||||
if (Model.Href.TrimEnd('/').ToUpperInvariant() == Request.Path.TrimEnd('/').ToUpperInvariant()) {
|
||||
Model.Classes.Add("current");
|
||||
}
|
||||
var tag = Tag(Model, "li");
|
||||
@tag.StartElement
|
||||
<a href="@Model.Href">@Model.Text</a>
|
||||
if (items.Any()) {
|
||||
<ul>
|
||||
@DisplayChildren(Model)
|
||||
</ul>
|
||||
}
|
||||
</li>
|
||||
@tag.EndElement
|
||||
}
|
||||
}
|
@@ -1,17 +1,22 @@
|
||||
@{
|
||||
// odd formatting in this file is to cause more attractive results in the output.
|
||||
var items = (IEnumerable<dynamic>)Enumerable.Cast<dynamic>(Model);
|
||||
// odd formatting in this file is to cause more attractive results in the output.
|
||||
var items = (IEnumerable<dynamic>)Enumerable.Cast<dynamic>(Model);
|
||||
}
|
||||
@{
|
||||
if (!HasText(Model.Text)) {
|
||||
@DisplayChildren(Model)
|
||||
} else {
|
||||
<li><a href="@Model.Href">@Model.Text</a>
|
||||
@if (items.Any()) {
|
||||
if (Model.Href.TrimEnd('/').ToUpperInvariant() == Request.Path.TrimEnd('/').ToUpperInvariant()) {
|
||||
Model.Classes.Add("current");
|
||||
}
|
||||
var tag = Tag(Model, "li");
|
||||
@tag.StartElement
|
||||
<a href="@Model.Href">@Model.Text</a>
|
||||
if (items.Any()) {
|
||||
<ul>
|
||||
@DisplayChildren(Model)
|
||||
</ul>
|
||||
}
|
||||
</li>
|
||||
@tag.EndElement
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user