Class: Pageflow::Generators::ActiveAdminMenuGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/pageflow/active_admin_menu/active_admin_menu_generator.rb

Instance Method Summary collapse

Instance Method Details

#configure_active_adminObject


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/pageflow/active_admin_menu/active_admin_menu_generator.rb', line 6

def configure_active_admin
  inject_into_file 'config/initializers/active_admin.rb', after: "ActiveAdmin.setup do |config|\n" do
    <<-RUBY
  config.namespace :admin do |admin|
    # Place a user user profile button next to the sign out link.
    admin.build_menu :utility_navigation do |menu|
menu.add(:label => proc { display_name current_active_admin_user },
         :id => 'current_user',
         :if => proc { current_active_admin_user? },
         :url => '/admin/users/me')
admin.add_logout_button_to_menu(menu)
    end
  end
RUBY
  end
end