Class: AdminTheme::SetupGenerator

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

Instance Method Summary collapse

Instance Method Details

#create_controllersObject



14
15
16
17
18
19
20
21
22
# File 'lib/generators/admin_theme/setup/setup_generator.rb', line 14

def create_controllers
  copy_file "../controllers/admin_base_controller.rb",      "app/controllers/admin/base_controller.rb"
  copy_file "../controllers/admin_dashboard_controller.rb", "app/controllers/admin/dashboard_controller.rb"

  inject_into_file "config/routes.rb",
"  namespace :admin do
root :to => 'dashboard#show', :as => 'dashboard'
  end\n\n", :after => "::Application.routes.draw do\n"
end

#create_javascriptObject



33
34
35
# File 'lib/generators/admin_theme/setup/setup_generator.rb', line 33

def create_javascript
  create_file "app/assets/javascripts/admin.js", "//= require jquery\n//= require jquery_ujs\n"
end

#create_stylesheetObject



24
25
26
27
28
29
30
31
# File 'lib/generators/admin_theme/setup/setup_generator.rb', line 24

def create_stylesheet
  create_file "app/assets/stylesheets/admin.css",
"/*
 *= require web-app-theme
 *= require web-app-theme/default
 *= require_self
*/\n"
end

#create_viewsObject



8
9
10
11
12
# File 'lib/generators/admin_theme/setup/setup_generator.rb', line 8

def create_views
  template "layout_admin.html.erb",   "app/views/layouts/admin.html.erb"
  template "view_sidebar.html.erb",   "app/views/admin/shared/_sidebar.html.erb"
  template "view_dashboard.html.erb", "app/views/admin/dashboard/show.html.erb"
end