Class: Backbone::Generators::ScaffoldGenerator

Inherits:
ModelGenerator
  • Object
show all
Defined in:
lib/generators/backbone/scaffold/scaffold_generator.rb

Instance Method Summary collapse

Methods inherited from ModelGenerator

#create_backbone_model

Methods included from Helpers

#application_name, #backbone_path, #collection_namespace, #js_app_name, #jst, #model_namespace, #plural_model_name, #router_namespace, #singular_model_name, #uncapitalize, #view_namespace

Instance Method Details

#create_router_filesObject



10
11
12
# File 'lib/generators/backbone/scaffold/scaffold_generator.rb', line 10

def create_router_files 
  template 'router.coffee', File.join(backbone_path, "routers", class_path, "#{plural_name}_router.js.coffee")
end

#create_view_filesObject



14
15
16
17
18
19
20
21
22
# File 'lib/generators/backbone/scaffold/scaffold_generator.rb', line 14

def create_view_files
  available_views.each do |view|
    template "views/#{view}_view.coffee", File.join(backbone_path, "views", plural_name, "#{view}_view.js.coffee")
    template "templates/#{view}.jst", File.join(backbone_path, "templates", plural_name, "#{view}.jst.ejs")       
  end
  
  template "views/model_view.coffee", File.join(backbone_path, "views", plural_name, "#{singular_name}_view.js.coffee")
  template "templates/model.jst", File.join(backbone_path, "templates", plural_name, "#{singular_name}.jst.ejs") 
end