Skip to content

Commit

Permalink
rerunning generators on dummy application
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Fitzgerald committed Feb 2, 2013
1 parent ccdadc2 commit a49f2ea
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
16 changes: 8 additions & 8 deletions lib/generators/backbone/install/install_generator.rb
Expand Up @@ -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
Expand Up @@ -17,4 +17,4 @@

</form>

<a href="#/index">Back</a>
<a href="#/index">Back</a>
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/dummy/db/schema.rb
Expand Up @@ -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

0 comments on commit a49f2ea

Please sign in to comment.