Class: Pageflow::Generators::ActiveAdminInitializerGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Pageflow::Generators::ActiveAdminInitializerGenerator
- Defined in:
- lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb
Instance Method Summary collapse
- #configure_active_admin ⇒ Object
- #configure_active_admin_load_path ⇒ Object
- #use_can_can ⇒ Object
- #use_devise ⇒ Object
Instance Method Details
#configure_active_admin ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb', line 14 def configure_active_admin inject_into_file 'config/initializers/active_admin.rb', after: "ActiveAdmin.setup do |config|\n" do <<-RUBY Pageflow.active_admin_settings(config) 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 |
#configure_active_admin_load_path ⇒ Object
8 9 10 11 12 |
# File 'lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb', line 8 def configure_active_admin_load_path prepend_to_file 'config/initializers/active_admin.rb' do "ActiveAdmin.application.load_paths += [Pageflow.active_admin_load_path]\n\n" end end |
#use_can_can ⇒ Object
43 44 45 46 47 |
# File 'lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb', line 43 def use_can_can gsub_file('config/initializers/active_admin.rb', '# config.authorization_adapter =', 'config.authorization_adapter =') end |
#use_devise ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb', line 33 def use_devise gsub_file('config/initializers/active_admin.rb', '# config.current_user_method =', 'config.current_user_method =') gsub_file('config/initializers/active_admin.rb', '# config.authentication_method =', 'config.authentication_method =') end |