Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1593 from EmpireOne/master

Navigation Icons
  • Loading branch information...
commit 97246a14a5fde5d6828fe7e746e9dbd0e156d06b 2 parents bb64c94 + fd753c0
@bbenezech bbenezech authored
View
3  app/helpers/rails_admin/application_helper.rb
@@ -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
View
4 lib/rails_admin/config/model.rb
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.