OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.38k stars 1.12k forks source link

Navigation menu #1949

Open orchardbot opened 13 years ago

orchardbot commented 13 years ago

evil_ created: https://orchard.codeplex.com/workitem/18122

Default navigation menu has a property named Selected which is always false.

orchardbot commented 13 years ago

evil_ commented:

When I implements INavigationProvider to build my own navigation menu from c# code, in this case Selected property works correct

orchardbot commented 13 years ago

evil_ commented:

Also Selected property isn't used in default MenuItem layout. The 'active' style set by equality of the browser link with navigation link.

orchardbot commented 12 years ago

evil_ commented:

I think it should have higher priority, cause it is actual to whole orchard. Another steps reproduce: 1) Go to /Admin/Users;

Result: Users menu is highlighted;

2) Got to /Admin/Users/Create

Result: Users menu is not highlighted;

This is my fix for MenuItem.cshtml:

var requestUrl = Request.Path.Replace(Request.ApplicationPath, string.Empty).TrimEnd('/').ToUpperInvariant(); var modelUrl = Model.Href.Replace(Request.ApplicationPath, string.Empty).TrimEnd('/').ToUpperInvariant(); if ((!string.IsNullOrEmpty(modelUrl) && (requestUrl.StartsWith(modelUrl) || requestUrl == modelUrl)) || (string.IsNullOrEmpty(modelUrl) && requestUrl == modelUrl)) { tabIsActive = true; }