Class: Opalla::ComponentGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Opalla::ComponentGenerator
- Defined in:
- lib/rails/generators/opalla/component_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_component ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/rails/generators/opalla/component_generator.rb', line 5 def create_component create_file js("components/#{file_name}_component.rb"), <<~CONTROLLER class #{class_name}Component < ApplicationComponent # Feel free to write your component actions, bindings, events end CONTROLLER end |
#create_views ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rails/generators/opalla/component_generator.rb', line 13 def create_views ext = defined?(Haml) ? 'haml' : 'erb' create_file js("views/components/_#{file_name}.#{ext}"), <<~VIEW .#{file_name.dasherize} -# Component content VIEW end |