Class: AdminInterface::Generators::SetupGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/admin_interface/setup_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_admin_routeObject

Helper files are kept in the Engine Gem. def copy_helper_files

copy_file("helpers/admin/base_helper.rb", "app/helpers/admin/base_helper.rb")

end



42
43
44
45
46
47
48
49
50
51
# File 'lib/generators/admin_interface/setup_generator.rb', line 42

def add_admin_route
  route <<ROUTE
namespace :admin do
    root :to => 'base#index'
    # resources :some_model do
    #   delete 'destroy_all', :on => :collection
    # end
  end
ROUTE
end

#copy_controller_filesObject

def copy_image_files

# Images
# Copy all images to public/images/admin
admin_image_dir = File.join('public', 'images', 'admin')
directory('images', admin_image_dir)

end



19
20
21
22
# File 'lib/generators/admin_interface/setup_generator.rb', line 19

def copy_controller_files
  copy_file("setup/controllers/base_controller.rb", "app/controllers/admin/base_controller.rb")
  copy_file("setup/controllers/resource_controller.rb", "app/controllers/admin/resource_controller.rb")    
end

#copy_view_filesObject



24
25
26
27
# File 'lib/generators/admin_interface/setup_generator.rb', line 24

def copy_view_files
  copy_file("setup/views/layout.html.erb", "app/views/layouts/admin.html.erb")
  copy_file("setup/views/index.html.erb", "app/views/admin/base/index.html.erb")
end

#show_readmeObject



53
54
55
# File 'lib/generators/admin_interface/setup_generator.rb', line 53

def show_readme
  readme('setup/INSTALL')
end