Class: Terrazzo::Generators::Views::EditGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
PageMappingHelper
Defined in:
lib/generators/terrazzo/views/edit_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_edit_templateObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/generators/terrazzo/views/edit_generator.rb', line 18

def copy_edit_template
  if resource.present?
    eject_json_props
    copy_file "pages/edit.jsx", "app/views/#{namespace_name}/#{resource_path}/edit.jsx"
    copy_file "pages/_form.jsx", "app/views/#{namespace_name}/#{resource_path}/_form.jsx"
    register_page_mapping("edit")
    eject_new_view if should_eject_new?
  else
    copy_file "pages/edit.jsx", "app/views/#{namespace_name}/application/edit.jsx"
    copy_file "pages/_form.jsx", "app/views/#{namespace_name}/application/_form.jsx"
    eject_new_view if should_eject_new?
  end
end