Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation (index) not showing for member actions - EDIT: for namespaced controllers #171

Open
mjrk opened this issue Jan 16, 2015 · 3 comments

Comments

@mjrk
Copy link

mjrk commented Jan 16, 2015

Not sure if this feature exists already, if it's a feature or bug.

My main navigation kind of depends on my first level (user context). In other words my main navigation is level 2. Now, if I'm on a member action of, let's say, edit on my users controller, the level 2 disappears completely - because I didn't add the "edit" action as a child of user#index.

I can fix this by adding all member actions. But ... with a growing application it really becomes a big overhead and I just want my navigation index item to highlight on member actions. I guess this is possible but I could not find it in the docs. Help appreciated.

@mjrk mjrk changed the title Navigation disappears for member actions Navigation (index) not showing for member actions Jan 16, 2015
@mjrk mjrk changed the title Navigation (index) not showing for member actions Navigation (index) not showing for member actions - EDIT: for namespaced controllers Jan 17, 2015
@mjrk
Copy link
Author

mjrk commented Jan 17, 2015

I noticed, that the problem only occurs in my namespaced controllers. In my non namespaced controller, the navigation level: 2 is not empty (, although the index is not highlighted, easy to fix with highlights_on).

@andi
Copy link
Collaborator

andi commented Jan 18, 2015

Not sure if I understand the problem correctly. So can you work around the issue with highlights_on regexp? That's basically what it was made for, to "catch" those circumstances where the standard behaviour is not feasible.

@mjrk
Copy link
Author

mjrk commented Jan 27, 2015

Well, in cases without further nesting (but admin) I only needed to add the highlights_on. However, with further nesting I need to catch

if @model_instance 
  ...

because member actions will fail without. At the end, the navigation.rb became pretty bloated.

The general setup will make member actions highlight the index as expected. But with namespaced controllers

primary.item :admin, "Admin view", admin_path do |admin_nav|
  admin_nav.item :customers, "Customers", admin_customers_path
  ...

I have to add hightlights_on and with some nesting even more logic (i.e. adding every member action or adding regexes for hightlights_on based on params[:controller] =~ etc.). I just wondered if member_actions shouldn't just hightlight the index-item out of the box, even on namespaced controllers. Especially confusing was, that the navigation level 2 disappeared completely when not working arround the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants