class Backbone::Generators::RouterGenerator

Constants

RESERVED_JS_WORDS

Public Instance Methods

create_router_files() click to toggle source
# File lib/generators/backbone/router/router_generator.rb, line 27
def create_router_files 
  template 'router.coffee', File.join(backbone_path, "routers", class_path, "#{file_name}_router.js.coffee")
end
create_view_files() click to toggle source
# File lib/generators/backbone/router/router_generator.rb, line 31
def create_view_files
   actions.each do |action|
     @action = action
     @view_path = File.join(backbone_path, "views", plural_name, "#{action}_view.js.coffee")
     @jst_path = File.join(backbone_path,"templates", plural_name, "#{action}.jst.ejs")
     
     template "view.coffee", @view_path
     template "template.jst", @jst_path
   end
end
validate_no_reserved_words() click to toggle source
# File lib/generators/backbone/router/router_generator.rb, line 18
def validate_no_reserved_words
  actions.each do |action|
    if RESERVED_JS_WORDS.include? action
       raise Thor::Error, "The name '#{action}' is reserved by javascript " <<
                          "Please choose an alternative action name and run this generator again."
    end
  end
end