The ActiveAdmin docs say that I can override the utility navigation like this:
ActiveAdmin.setup do |config|
config.namespace :admin do |admin|
admin.build_menu :utility_navigation do |menu|
menu.add label: "ActiveAdmin.info", url: "http://www.activeadmin.info", html_options: { target: :blank }
admin.add_logout_button_to_menu menu # can also pass priority & html_options for link_to to use
end
end
end
It also says that the default display includes the current user's email address. How does it get the current user's email address? When I try replacing the menu.add label
value with current_admin_user
I get an error that says current_admin_user
is undefined. How do I access info about the currently signed in user from the config file? How does ActiveAdmin do it behind the scenes?
config.namespace :admin do |admin|
admin.build_menu :utility_navigation do |menu|
menu.add :label => proc{ display_name current_active_admin_user },
:url => proc{ edit_admin_admin_user_path(current_active_admin_user) } ,#link_to current_active_admin_user,
:id => 'current_user',
:if => proc{ current_active_admin_user? }
admin.add_logout_button_to_menu menu
end
end
Just try the following:
ActiveAdmin.setup do |config|
config.namespace :admin do |admin|
admin.build_menu :utility_navigation do |menu|
menu.add label: "ActiveAdmin.info", url: "http://www.activeadmin.info",
html_options: { target: :blank }
admin.add_current_user_to_menu menu
admin.add_logout_button_to_menu menu
end
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With