This project is read-only.

Orchard Admin Menu via INavigationProvider not working

Topics: Administration, Troubleshooting, Writing modules
Sep 18, 2012 at 8:51 AM



I've been following sfmskywalker's tutorial (Part 10) on creating an admin view to edit content items.  Yesterday I built this and was having a blast as it ran perfectly.  This morning, all of the sudden, the admin menu item stopped working and simply seems to refresh the admin area rather than rendering the view of the Index action on my controller.  The biggest issue here is that it seems to be non-debuggable and there's no mention of anything in the logs (they are and remain empty).  Any ideas on this one?  Following is my AdminMenu.cs:

using System.Web.Routing;
using Orchard.Environment;
using Orchard.Localization;
using Orchard.UI.Navigation;

namespace Orchard.Ekalaya
    public class AdminMenu : INavigationProvider
        #region Declarations

        private readonly Work<RequestContext> _requestContextAccessor;

        #endregion Declarations

        #region Construction/Destruction

        public AdminMenu(Work<RequestContext> requestContextAccessor)
            _requestContextAccessor = requestContextAccessor;
            T = NullLocalizer.Instance;
        #endregion Construction/Destruction

        #region Methods

        public void GetNavigation(NavigationBuilder builder)
            var requestContext = _requestContextAccessor.Value;
            var idValue = (string)requestContext.RouteData.Values["id"];
            var id = 0;

            if (!string.IsNullOrEmpty(idValue))
                int.TryParse(idValue, out id);


                // Image set
                // "Webshop"
                .Add(item => item
                    // "Doopsuiker"
                    .Add(subItem => subItem
                        .Action("Index", "DoopsuikerAdmin", new { area = "Orchard.Ekalaya" })
                        .Add(T("Details"), i => i.Action("Edit", "DoopsuikerAdmin", new { id }).LocalNav())
                        .Add(T("Colors"), i => i.Action("ListColors", "DoopsuikerAdmin", new { id }).LocalNav())

                    //// "Fotografie"
                    //.Add(subItem => subItem
                    //    .Caption(T("Fotografie"))
                    //    .Position("2.2")
                    //    .Action("Index", "FotografieAdmin", new { area = "2Elemental.Orchard.Ekalaya" })

        #endregion Methods
        #region Accessors

        public Localizer T { get; set; }

        public string MenuName { get { return "admin"; } }

        #endregion Accessors

Sep 18, 2012 at 8:57 AM

Some additional info: when I hover my menu item in the admin section,
it seems as if the url isn't bound to the html anchor, it always points to
the currently open page in the admin section...

Sep 18, 2012 at 12:06 PM

This seems to be quite fuzzy, if I switch the position between the subItems "Doopsuiker" and "Fotografie" it works, when switching back it stops working again??

Sep 18, 2012 at 4:49 PM

This sounds like a repro. Please file a bug.