Skip to content

Commit

Permalink
Merge pull request railsadminteam#1593 from EmpireOne/master
Browse files Browse the repository at this point in the history
Navigation Icons
  • Loading branch information
bbenezech committed Apr 4, 2013
2 parents bb64c94 + fd753c0 commit 97246a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/helpers/rails_admin/application_helper.rb
Expand Up @@ -79,9 +79,10 @@ def navigation nodes_stack, nodes, level=0
model_param = node.abstract_model.to_param
url = url_for(:action => :index, :controller => 'rails_admin/main', :model_name => model_param)
level_class = " nav-level-#{level}" if level > 0
nav_icon = node.navigation_icon ? %{<i class="#{node.navigation_icon}"></i>}.html_safe : ''

li = content_tag :li, "data-model"=>model_param do
link_to node.label_plural, url, :class => "pjax#{level_class}"
link_to nav_icon + node.label_plural, url, :class => "pjax#{level_class}"
end
li + navigation(nodes_stack, nodes_stack.select{ |n| n.parent.to_s == node.abstract_model.model_name}, level+1)
end.join.html_safe
Expand Down
4 changes: 4 additions & 0 deletions lib/rails_admin/config/model.rb
Expand Up @@ -82,6 +82,10 @@ def pluralize(count)
@navigation_label ||= (parent_module = abstract_model.model.parent) != Object ? parent_module.to_s : nil
end

register_instance_option :navigation_icon do
nil
end

# Act as a proxy for the base section configuration that actually
# store the configurations.
def method_missing(m, *args, &block)
Expand Down

0 comments on commit 97246a1

Please sign in to comment.