Class: Ng::Generators::FormGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/ng/form/form_generator.rb

Instance Method Summary collapse

Instance Method Details

#formObject



8
9
10
11
# File 'lib/generators/ng/form/form_generator.rb', line 8

def form
  template 'form.html.erb', "app/assets/templates/#{plural_name}/form.html.erb"
  template 'form_ctrl.coffee', "app/assets/javascripts/ng/controllers/#{singular_name}_form_ctrl.coffee"
end

#routeObject



17
18
19
20
21
22
23
24
# File 'lib/generators/ng/form/form_generator.rb', line 17

def route
  inject_ng_route do
    "    .state         '#{ng_singular_name}Form',\n"\
    "      controller:  '#{class_name}FormCtrl'\n"\
    "      url:         '/#{plural_name}/new'\n"\
    "      templateUrl: '#{plural_name}/form.html'\n\n"
  end
end

#specObject



13
14
15
# File 'lib/generators/ng/form/form_generator.rb', line 13

def spec
  template 'spec.rb.erb', "spec/features/#{singular_name}_show_spec.rb"
end