Skip to content

Commit

Permalink
And more.
Browse files Browse the repository at this point in the history
  • Loading branch information
gunn committed Oct 2, 2012
1 parent a4e0dca commit b4508e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/helpers/rails_admin/application_helper.rb
Expand Up @@ -44,9 +44,11 @@ def wording_for(label, action = @action, abstract_model = @abstract_model, objec

def main_navigation
nodes_stack = RailsAdmin::Config.visible_models(:controller => self.controller)
node_model_names = nodes_stack.map{ |c| c.abstract_model.model_name }

nodes_stack.group_by(&:navigation_label).map do |navigation_label, nodes|

nodes = nodes.select{|n| n.parent.nil? || !n.parent.to_s.in?(nodes_stack.map{|c| c.abstract_model.model_name }) }
nodes = nodes.select{ |n| n.parent.nil? || !n.parent.to_s.in?(node_model_names) }
li_stack = nodes.map do |node|
model_param = node.abstract_model.to_param

Expand Down

0 comments on commit b4508e3

Please sign in to comment.