Sha256: 36eb7a65445ac8a9cb2e1b69fbf62df55a4f7eaacbbccfc8fa5ac42bfef83b12

Contents?: true

Size: 1.13 KB

Versions: 17

Compression:

Stored size: 1.13 KB

Contents

require 'generators/backbone/model/model_generator'

module Backbone
  module Generators
    class ScaffoldGenerator < ModelGenerator
      
      source_root File.expand_path("../templates", __FILE__)
      desc "This generator creates the client side crud scaffolding"
      
      def create_router_files 
        template 'router.coffee', File.join(backbone_path, "routers", class_path, "#{plural_name}_router.js.coffee")
      end
      
      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
      
      protected
        def available_views
          %w(index show new edit)
        end
        
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
bbr-wsm-1.1.0 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-1.2.0 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.9.10 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.9.0 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.8.0 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.7.2 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.7.1 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.7.0 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.6.1 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.6.0 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.6.0.rc lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.5.5 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.5.4 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.5.3 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.5.2 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.5.1 lib/generators/backbone/scaffold/scaffold_generator.rb
rails-backbone-0.5.0 lib/generators/backbone/scaffold/scaffold_generator.rb