Sha256: 3b3823cfd5fb22c931038f67e7d9a97eb05942454da951047ab25671f01a78ed

Contents?: true

Size: 851 Bytes

Versions: 10

Compression:

Stored size: 851 Bytes

Contents

module Pageflow
  module Generators
    class ActiveAdminInitializerGenerator < Rails::Generators::Base
      desc "Configure active admin utilitiy menu to contain profile link."

      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
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pageflow-0.10.0 lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb
pageflow-0.9.2 lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb
pageflow-0.9.1 lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb
pageflow-0.9.0 lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb
pageflow-0.8.2 lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb
pageflow-0.8.1 lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb
pageflow-0.8.0 lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb
pageflow-0.7.2 lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb
pageflow-0.7.1 lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb
pageflow-0.7.0 lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb