Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rerunning generators on dummy application

  • Loading branch information...
commit a49f2ea65e1d70d206f6608bd405fb1968f6d070 1 parent ccdadc2
@ryanfitz ryanfitz authored
View
16 lib/generators/backbone/install/install_generator.rb
@@ -4,31 +4,31 @@ module Backbone
module Generators
class InstallGenerator < Rails::Generators::Base
include Backbone::Generators::ResourceHelpers
-
+
source_root File.expand_path("../templates", __FILE__)
-
+
desc "This generator installs backbone.js with a default folder layout in app/assets/javascripts/backbone"
-
+
class_option :skip_git, :type => :boolean, :aliases => "-G", :default => false,
:desc => "Skip Git ignores and keeps"
-
+
def inject_backbone
inject_into_file "app/assets/javascripts/application.js", :before => "//= require_tree" do
"//= require underscore\n//= require backbone\n//= require backbone_rails_sync\n//= require backbone_datalink\n//= require backbone/#{application_name.underscore}\n"
end
end
-
+
def create_dir_layout
%W{routers models views templates}.each do |dir|
empty_directory "app/assets/javascripts/backbone/#{dir}"
create_file "app/assets/javascripts/backbone/#{dir}/.gitkeep" unless options[:skip_git]
end
end
-
+
def create_app_file
template "app.coffee", "app/assets/javascripts/backbone/#{application_name.underscore}.js.coffee"
end
-
+
end
end
-end
+end
View
2  test/dummy/app/assets/javascripts/backbone/templates/posts/edit.jst.ejs
@@ -17,4 +17,4 @@
</form>
-<a href="#/index">Back</a>
+<a href="#/index">Back</a>
View
12 test/dummy/app/assets/javascripts/backbone/views/posts/edit_view.js.coffee
@@ -1,22 +1,22 @@
Dummy.Views.Posts ||= {}
class Dummy.Views.Posts.EditView extends Backbone.View
- template : JST["backbone/templates/posts/edit"]
+ template: JST["backbone/templates/posts/edit"]
- events :
- "submit #edit-post" : "update"
+ events:
+ "submit #edit-post": "update"
- update : (e) ->
+ update: (e) ->
e.preventDefault()
e.stopPropagation()
@model.save(null,
- success : (post) =>
+ success: (post) =>
@model = post
window.location.hash = "/#{@model.id}"
)
- render : ->
+ render: ->
@$el.html(@template(@model.toJSON() ))
this.$("form").backboneLink(@model)
View
4 test/dummy/db/schema.rb
@@ -16,8 +16,8 @@
create_table "posts", :force => true do |t|
t.string "title"
t.text "body"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.