Class: SmartAdmin::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#generate_layoutObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/smart_admin/install_generator.rb', line 6

def generate_layout
  copy_file "assets/admin.scss", "app/assets/stylesheets/admin.scss"
  copy_file "assets/admin.js", "app/assets/javascripts/admin.js"

  template "controllers/base_controller.rb", "app/controllers/admin/base_controller.rb"
  template "controllers/dashboards_controller.rb", "app/controllers/admin/dashboards_controller.rb"

  template "views/layouts/admin.html.haml", "app/views/layouts/admin.html.haml"
  copy_file "views/layouts/_flash.html.erb", "app/views/layouts/_flash.html.erb"
  template "views/layouts/_skinconfig.html.haml", "app/views/layouts/admin/_skinconfig.html.haml"
  template "views/layouts/_navigation.html.haml", "app/views/layouts/admin/_navigation.html.haml"
  template "views/layouts/_topnavbar.html.haml", "app/views/layouts/admin/_topnavbar.html.haml"
  template "views/layouts/_footer.html.haml", "app/views/layouts/admin/_footer.html.haml"
  template "views/layouts/_rightsidebar.html.haml", "app/views/layouts/admin/_rightsidebar.html.haml"
  template "views/admin/dashboards/index.html.haml", "app/views/admin/dashboards/index.html.haml"

  insert_into_file "config/routes.rb", "
    namespace :admin do\n
      resources :dashboards, only: [:index]\n
    end
    match '/admin', to: 'admin/dashboards#index', via: 'get'
  ", after: "Rails.application.routes.draw do\n"
end