From 766ee10a6c9785eebd4a9c06cce0f0fd65344a71 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Tue, 12 Oct 2010 09:04:48 -0700 Subject: [PATCH] Adding the "current" class back to the current menu item --HG-- branch : dev --- .../Core/Shapes/Views/MenuItem.cshtml | 17 +++++++++++------ .../TheThemeMachine/Views/MenuItem.cshtml | 15 ++++++++++----- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/Orchard.Web/Core/Shapes/Views/MenuItem.cshtml b/src/Orchard.Web/Core/Shapes/Views/MenuItem.cshtml index cdf9d01e8..7b96d871d 100644 --- a/src/Orchard.Web/Core/Shapes/Views/MenuItem.cshtml +++ b/src/Orchard.Web/Core/Shapes/Views/MenuItem.cshtml @@ -1,17 +1,22 @@ @{ - // odd formatting in this file is to cause more attractive results in the output. - var items = (IEnumerable)Enumerable.Cast(Model); + // odd formatting in this file is to cause more attractive results in the output. + var items = (IEnumerable)Enumerable.Cast(Model); } @{ -if (string.IsNullOrWhiteSpace((string)Model.Text)) { +if (!HasText(Model.Text)) { @DisplayChildren(Model) } else { -
  • @Model.Text - @if (items.Any()) { + if (Model.Href.TrimEnd('/').ToUpperInvariant() == Request.Path.TrimEnd('/').ToUpperInvariant()) { + Model.Classes.Add("current"); + } + var tag = Tag(Model, "li"); + @tag.StartElement + @Model.Text + if (items.Any()) {
      @DisplayChildren(Model)
    } -
  • + @tag.EndElement } } \ No newline at end of file diff --git a/src/Orchard.Web/Themes/TheThemeMachine/Views/MenuItem.cshtml b/src/Orchard.Web/Themes/TheThemeMachine/Views/MenuItem.cshtml index 0ea390f6b..7b96d871d 100644 --- a/src/Orchard.Web/Themes/TheThemeMachine/Views/MenuItem.cshtml +++ b/src/Orchard.Web/Themes/TheThemeMachine/Views/MenuItem.cshtml @@ -1,17 +1,22 @@ @{ - // odd formatting in this file is to cause more attractive results in the output. - var items = (IEnumerable)Enumerable.Cast(Model); + // odd formatting in this file is to cause more attractive results in the output. + var items = (IEnumerable)Enumerable.Cast(Model); } @{ if (!HasText(Model.Text)) { @DisplayChildren(Model) } else { -
  • @Model.Text - @if (items.Any()) { + if (Model.Href.TrimEnd('/').ToUpperInvariant() == Request.Path.TrimEnd('/').ToUpperInvariant()) { + Model.Classes.Add("current"); + } + var tag = Tag(Model, "li"); + @tag.StartElement + @Model.Text + if (items.Any()) {
      @DisplayChildren(Model)
    } -
  • + @tag.EndElement } } \ No newline at end of file