Admin menu href is empty

Topics: Customizing Orchard
Jul 20, 2011 at 7:21 PM

Hi,

 

I have created module. I want display module link in admin menu. I can see module name in admin menu. But href is empty, When i see view source its like this

</li><li class="section-status">            <h3><a class="navicon-status" href="">Status</a></h3>

My admin menu class is here

namespace PAM.Subscriber.Status
{
    public class AdminMenu : INavigationProvider {
        public Localizer T { get; set; }

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

        public void GetNavigation(NavigationBuilder builder) {
            builder.AddImageSet("status")
                .Add(T("Status"), "4",
                    menu => menu.Add(T("List"), "2", item => item.Action("Index", "Admin", new { area = "PAM.Subscriber.Status" })
                        .Permission(Permissions.ManageStatus )));
        }
    }
}

where is the problem

 

lakmal

Coordinator
Jul 20, 2011 at 8:37 PM

Looks like you're one level too deep here. You may want to find an existing example that does exactly what you want and adapt it.

Jul 22, 2011 at 6:17 PM

Still i coudnt fix this, i follow same as what in comment module . Is there any other file effect to href value?

 

lakmal

Coordinator
Jul 26, 2011 at 1:02 AM

OK then, well, do you have an AdminController in that area, that has an Index action?

Jul 26, 2011 at 4:27 AM

Hi,

 

This is my controller

 public ActionResult Index(StatusIndexOptions options, PagerParameters pagerParameters)
        {
            Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);

            // Default options
            if (options == null)
                options = new StatusIndexOptions();

            // Filtering
            IContentQuery statuses;
            try
            {
                statuses = _statusService.GetStatuss();               

                var pagerShape = Shape.Pager(pager).TotalItemCount(statuses.Count());
                var entries = statuses
                    .OrderByDescending(cpr => cpr.StatusIndex)
                    .Slice(pager.GetStartIndex(), pager.PageSize)
                    .ToList()
                    .Select(status => CreateStatusEntry(status.Record));

                var model = new StatusIndexViewModel
                {
                    Status = entries.ToList()
                    
                };
                return View(model);
            }
            catch (Exception exception)
            {
                this.Error(exception, T("Listing Status failed: {0}", exception.Message), Logger, Services.Notifier);

                return View(new StatusIndexViewModel());
            }

        }

Coordinator
Jul 26, 2011 at 7:22 PM

Well, I wasn't asking to see the code for the controller, as the problem is apparently well before that, in routing, and this code is never found. That's why I was asking if the controller and action were named consistently with what you put in the menu code. You may also want to verify the name of the area is consistent with your module name.