Sha256: ff20028b9bb03d04e32ade5c314d8884e12cd308cc83572bc69609d3acd0c71e

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

class AdminInterfaceGenerator < Rails::Generators::Base

  source_root File.expand_path("../templates", __FILE__)

  # 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

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

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

  # def copy_javascript_files
  #   copy_file("javascripts/jquery.admin.js", "public/javascripts/jquery.admin.js")
  # end
  # 
  # def copy_stylesheet_files
  #   copy_file("views/admin.css", "public/stylesheets/admin.css")
  # end

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

  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

  def show_readme
    readme("INSTALL")
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
admin_interface-1.3.1 lib/generators/admin_interface/admin_interface_generator.rb
admin_interface-1.3.0 lib/generators/admin_interface/admin_interface_generator.rb