Class: Katapult::Generators::HamlGenerator
Instance Attribute Summary
#element
Instance Method Summary
collapse
#initialize
Instance Method Details
32
33
34
35
36
37
38
39
40
|
# File 'lib/generators/katapult/haml/haml_generator.rb', line 32
def create_form_partial_if_needed
_form_actions = (actions.map(&:name) & %w[new edit])
if _form_actions.any?
file_name = '_form.html.haml'
create_view file_name, File.join(views_path, file_name)
end
end
|
#create_rails_standard_action_views ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/generators/katapult/haml/haml_generator.rb', line 24
def create_rails_standard_action_views
actions.select{ |a| a.get? && WUI::RAILS_ACTIONS.include?(a.name) }.each do |action|
file_name = "#{action.name}.html.haml"
create_view file_name, File.join(views_path, file_name)
end
end
|
#create_views_directory ⇒ Object
20
21
22
|
# File 'lib/generators/katapult/haml/haml_generator.rb', line 20
def create_views_directory
FileUtils.mkdir_p views_path
end
|
#create_views_for_custom_actions ⇒ Object
42
43
44
45
46
47
|
# File 'lib/generators/katapult/haml/haml_generator.rb', line 42
def create_views_for_custom_actions
wui.custom_actions.select(&:get?).each do |action|
@action = action
create_view 'custom_action.html.haml', File.join(views_path, "#{action.name}.html.haml")
end
end
|
#generate_integration_tests ⇒ Object
49
50
51
52
53
|
# File 'lib/generators/katapult/haml/haml_generator.rb', line 49
def generate_integration_tests
if wui.model.present?
Generators::CucumberFeaturesGenerator.new(wui.model).invoke_all
end
end
|
#install_application_layout ⇒ Object
14
15
16
17
18
|
# File 'lib/generators/katapult/haml/haml_generator.rb', line 14
def install_application_layout
remove_file 'app/views/layouts/application.html.erb'
template 'app/views/layouts/application.html.haml'
template 'app/views/layouts/_flashes.html.haml'
end
|