Class: KisoThemes::Generators::PageGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.view_name(type, name) ⇒ Object



29
30
31
32
33
34
# File 'lib/generators/kiso_themes/page_generator.rb', line 29

def self.view_name(type, name)
  self._view_name = name
  self._view_type = type
  desc "Creates a #{name} page style view under app/views/CONTROLLER/ACTION and its controller."
  source_root File.expand_path('../templates', __FILE__)
end

Instance Method Details

#copy_viewObject



22
23
24
25
26
27
# File 'lib/generators/kiso_themes/page_generator.rb', line 22

def copy_view
  for action in actions do
    view_name = action
    copy_file "views/#{_view_type}/#{_view_name}_#{options.variant}.html.#{handler}", "app/views/#{name.downcase.underscore}/#{action}.html.#{handler}"
  end
end

#create_controllerObject



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

def create_controller
  invoke :controller, [name, actions], skip: false, skip_routes: false, helper: false, test_framework: false, assets: false, template_engine: false
  # Rails.autoloaders.main.reload
end