Skip to content
Browse files

Eliminated duplicated method body.

  • Loading branch information...
1 parent b4508e3 commit 85f316d0f6ddd2ed21ec07de87625abacb6cf9bc @gunn committed Oct 2, 2012
Showing with 2 additions and 10 deletions.
  1. +2 −10 app/helpers/rails_admin/application_helper.rb
View
12 app/helpers/rails_admin/application_helper.rb
@@ -49,15 +49,7 @@ def main_navigation
nodes_stack.group_by(&:navigation_label).map do |navigation_label, nodes|
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
-
- %{<li data-model="#{model_param}">
- <a class="pjax" href="#{url_for(:action => :index, :controller => 'rails_admin/main', :model_name => model_param)}">#{node.label_plural}</a>
- </li>
- #{navigation(nodes_stack, nodes_stack.select{|n| n.parent.to_s == node.abstract_model.model_name}, 1)}
- }
- end.join
+ li_stack = navigation nodes_stack, nodes
label = navigation_label || t('admin.misc.navigation')
%{<li class='nav-header'>#{label}</li>#{li_stack}} if li_stack.present?
@@ -74,7 +66,7 @@ def static_navigation
li_stack
end
- def navigation nodes_stack, nodes, level
+ def navigation nodes_stack, nodes, level=0
nodes.map do |node|
model_param = node.abstract_model.to_param

0 comments on commit 85f316d

Please sign in to comment.
Something went wrong with that request. Please try again.