Class: KisoThemes::Generators::AppPagesGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
HandlerSupport
Defined in:
lib/generators/kiso_themes/app_pages_generator.rb

Direct Known Subclasses

UserAccountPagesGenerator

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.set_page_type(page_type) ⇒ Object



26
27
28
29
# File 'lib/generators/kiso_themes/app_pages_generator.rb', line 26

def self.set_page_type(page_type)
  self.app_page_type = page_type
  source_root File.expand_path('../templates', __FILE__)
end

Instance Method Details

#copy_viewObject



17
18
19
# File 'lib/generators/kiso_themes/app_pages_generator.rb', line 17

def copy_view
  directory( "views/app_pages/#{app_page_type}", "app/views/#{name.underscore}/", { recursive: true, exclude_pattern: /\.(#{unsupported_handlers.join('|')})/ } )
end

#create_controllerObject



13
14
15
# File 'lib/generators/kiso_themes/app_pages_generator.rb', line 13

def create_controller
  invoke :controller, [name], skip: false, skip_routes: true, helper: false, test_framework: false, assets: false, template_engine: false
end

#set_layoutObject



21
22
23
24
# File 'lib/generators/kiso_themes/app_pages_generator.rb', line 21

def set_layout
  controller_const_name = "#{name.camelize}Controller"
  inject_into_class File.join('app/controllers', class_path, "#{file_name}_controller.rb"), controller_const_name, "  layout 'application'\n"
end