Permalink
Browse files

Merge branch 'edit-view-colons' into develop

Conflicts:
	lib/generators/backbone/scaffold/templates/views/edit_view.coffee
  • Loading branch information...
2 parents 714d15b + decfe3a commit 80525c4cb6f43332e2df8678c7098cb2f8d20e27 @mkelley33 committed Nov 8, 2012
@@ -14,4 +14,4 @@
</form>
-<a href="#/index">Back</a>
+<a href="#/index">Back</a>
@@ -1,17 +1,17 @@
<%= view_namespace %> ||= {}
class <%= view_namespace %>.EditView extends Backbone.View
- template : JST["<%= jst 'edit' %>"]
+ template: JST["<%= jst 'edit' %>"]
- events :
- "submit #edit-<%= singular_name %>" : "update"
+ events:
+ "submit #edit-<%= singular_name %>": "update"
- update : (e) ->
+ update: (e) ->
e.preventDefault()
e.stopPropagation()
@model.save(null,
- success : (<%= singular_name %>) =>
+ success: (<%= singular_name %>) =>
@model = <%= singular_name %>
window.location.hash = "/#{@model.id}"
)
@@ -62,8 +62,8 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
assert_file "#{backbone_path}/views/posts/edit_view.js.coffee" do |view|
assert_match /class Dummy.Views.Posts.EditView extends Backbone.View/, view
assert_match /#{Regexp.escape('JST["backbone/templates/posts/edit"]')}/, view
- assert_match /#{Regexp.escape('"submit #edit-post" : "update"')}/, view
- assert_match /#{Regexp.escape('success : (post) =>')}/, view
+ assert_match /#{Regexp.escape('"submit #edit-post": "update"')}/, view
+ assert_match /#{Regexp.escape('success: (post) =>')}/, view
end
assert_file "#{backbone_path}/views/posts/post_view.js.coffee" do |view|
@@ -99,9 +99,12 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
assert_file "#{backbone_path}/views/blog_posts/edit_view.js.coffee" do |view|
assert_match /class Dummy.Views.BlogPosts.EditView extends Backbone.View/, view
- assert_match /#{Regexp.escape('JST["backbone/templates/blog_posts/edit"]')}/, view
- assert_match /#{Regexp.escape('"submit #edit-blog_post" : "update"')}/, view
- assert_match /#{Regexp.escape('success : (blog_post) =>')}/, view
+ assert_match /#{Regexp.escape('template: JST["backbone/templates/blog_posts/edit"]')}/, view
+ assert_match /#{Regexp.escape('"submit #edit-blog_post": "update"')}/, view
+ assert_match /#{Regexp.escape('success: (blog_post) =>')}/, view
+ assert_match /#{Regexp.escape('events:')}/, view
+ assert_match /#{Regexp.escape('update: (e) ->')}/, view
+ assert_match /#{Regexp.escape('render: ->')}/, view
end
assert_file "#{backbone_path}/views/blog_posts/blog_post_view.js.coffee" do |view|
@@ -173,4 +176,4 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
end
end
-end
+end

0 comments on commit 80525c4

Please sign in to comment.