Class: Adminlte::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#copy_form_builderObject



23
24
25
# File 'lib/generators/adminlte/install/install_generator.rb', line 23

def copy_form_builder
  copy_file "form_builder/_form.html.#{options[:template_engine]}", "lib/templates/#{options[:template_engine]}/scaffold/_form.html.#{options[:template_engine]}" 
end

#copy_imagesObject



19
20
21
# File 'lib/generators/adminlte/install/install_generator.rb', line 19

def copy_images
  directory "img/", "public/img"
end

#copy_libObject



15
16
17
# File 'lib/generators/adminlte/install/install_generator.rb', line 15

def copy_lib
  directory "lib/templates/#{options[:template_engine]}"
end

#copy_nav_helperObject



27
28
29
# File 'lib/generators/adminlte/install/install_generator.rb', line 27

def copy_nav_helper
  copy_file "helpers/navigation_helper.rb", "app/helpers/nav_helper.rb"
end

#create_layoutObject



31
32
33
34
35
# File 'lib/generators/adminlte/install/install_generator.rb', line 31

def create_layout
  template "layouts/dashboard.html.#{options[:template_engine]}", "app/views/layouts/#{options[:layout_name]}.html.#{options[:template_engine]}"
  template "layouts/_header.html.#{options[:template_engine]}", "app/views/layouts/_#{options[:layout_name]}_header.html.#{options[:template_engine]}"
  template "layouts/_sidebar.html.#{options[:template_engine]}", "app/views/layouts/_#{options[:layout_name]}_sidebar.html.#{options[:template_engine]}"
end

#create_stylesheetsObject



37
38
39
# File 'lib/generators/adminlte/install/install_generator.rb', line 37

def create_stylesheets
  copy_file "assets/stylesheets/adminlte_overrides.#{options[:stylesheet_engine]}", "app/assets/stylesheets/adminlte_overrides.#{options[:stylesheet_engine]}"
end

#inject_adminlteObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/generators/adminlte/install/install_generator.rb', line 41

def inject_adminlte
  application_js_path = "app/assets/javascripts/#{options[:layout_name]}.js"

  if ::File.exists?(::File.join(destination_root, application_js_path))
    inject_into_file application_js_path, before: '//= require_tree' do
      "//= require bootstrap\n"+
      "//= require adminlte\n"
    end
  end
end