Class: AdminInterface::Generators::SetupGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- AdminInterface::Generators::SetupGenerator
- Defined in:
- lib/generators/admin_interface/setup_generator.rb
Instance Method Summary collapse
-
#add_admin_route ⇒ Object
Helper files are kept in the Engine Gem.
-
#copy_controller_files ⇒ Object
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.
- #copy_view_files ⇒ Object
- #show_readme ⇒ Object
Instance Method Details
#add_admin_route ⇒ Object
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_files ⇒ Object
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_files ⇒ Object
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_readme ⇒ Object
53 54 55 |
# File 'lib/generators/admin_interface/setup_generator.rb', line 53 def show_readme readme('setup/INSTALL') end |