Class: Uistiti::ComponentGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/uistiti/component_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_and_import_cssObject



15
16
17
18
19
# File 'lib/generators/uistiti/component_generator.rb', line 15

def create_and_import_css
  file_path = "app/assets/stylesheets/uistiti/components/#{status_path}#{underscore_name}.scss"
  template("component.scss.tt", file_path)
  insert_into_file("app/assets/stylesheets/uistiti/uistiti.scss", "@import \"components/#{status_path}#{underscore_name}\";\n")
end

#create_controllerObject



7
8
9
# File 'lib/generators/uistiti/component_generator.rb', line 7

def create_controller
  template("component.tt", "app/components/uistiti/#{status_path}#{underscore_name}.rb")
end

#create_previewObject



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

def create_preview
  template("preview.tt", "app/components/previews/uistiti/#{status_path}#{underscore_name}_preview.rb")
end

#create_stimulusObject



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

def create_stimulus
  template("component.js.tt", "app/assets/javascript/controllers/uistiti/#{status_path}#{underscore_name}_controller.js")
end

#create_templateObject



11
12
13
# File 'lib/generators/uistiti/component_generator.rb', line 11

def create_template
  template("component.html.tt", "app/components/uistiti/#{status_path}#{underscore_name}.html.erb")
end