Class: Para::ComponentGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Generators::ComponentHelpers
Defined in:
lib/generators/para/component/component_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_routeObject



29
30
31
# File 'lib/generators/para/component/component_generator.rb', line 29

def add_route
  add_component_to_routes :component, file_name
end

#copy_componentObject



13
14
15
# File 'lib/generators/para/component/component_generator.rb', line 13

def copy_component
  template 'component.rb', "app/components/#{ component_file_name }.rb"
end

#copy_component_controllerObject



21
22
23
# File 'lib/generators/para/component/component_generator.rb', line 21

def copy_component_controller
  template 'component_controller.rb', "app/controllers/admin/#{ component_file_name }_controller.rb"
end

#copy_component_decoratorObject



17
18
19
# File 'lib/generators/para/component/component_generator.rb', line 17

def copy_component_decorator
  template 'decorator.rb', "app/decorators/#{ decorator_file_name }.rb"
end

#create_show_component_viewObject



25
26
27
# File 'lib/generators/para/component/component_generator.rb', line 25

def create_show_component_view
  template 'show.html.haml', "app/views/admin/#{ component_file_name }/show.html.haml"
end

#welcomeObject



9
10
11
# File 'lib/generators/para/component/component_generator.rb', line 9

def welcome
  say 'Creating component...'
end